mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
318c35c2cb
* Some minor implementations * Some more * Lots more * Removed 'backend' alias * removed all promises * Removed a bunch of module exports stuff * Some morE' * Fix * custom DNS * Tests for DNS * bug fix * Some small adjustments * Small stuff
32 lines
666 B
JavaScript
32 lines
666 B
JavaScript
import * as db from '../index';
|
|
|
|
export const type = 'Response';
|
|
export const prefix = 'res';
|
|
export function init () {
|
|
return db.initModel({
|
|
statusCode: 0,
|
|
statusMessage: '',
|
|
contentType: 'text/plain',
|
|
url: '',
|
|
bytesRead: 0,
|
|
elapsedTime: 0,
|
|
headers: [],
|
|
cookies: [],
|
|
body: '',
|
|
error: ''
|
|
})
|
|
}
|
|
|
|
export function create (patch = {}) {
|
|
if (!patch.parentId) {
|
|
throw new Error('New Response missing `parentId`');
|
|
}
|
|
|
|
db.removeBulkSilently(type, {parentId: patch.parentId});
|
|
return db.docCreate(type, patch);
|
|
}
|
|
|
|
export function getLatestByParentId (parentId) {
|
|
return db.getMostRecentlyModified(type, {parentId});
|
|
}
|