diff --git a/app/models/__tests__/response.test.js b/app/models/__tests__/response.test.js index 53b8bcd6c..c086942f6 100644 --- a/app/models/__tests__/response.test.js +++ b/app/models/__tests__/response.test.js @@ -20,13 +20,13 @@ describe('migrate()', () => { ); const storedBody = models.response.getBodyBuffer({bodyPath: expectedBodyPath}); - // Should have stripped these - expect(newModel.body).toBeUndefined(); - expect(newModel.encoding).toBeUndefined(); - // Should have set bodyPath and stored the body expect(newModel.bodyPath).toBe(expectedBodyPath); expect(storedBody + '').toBe('hello world!'); + + // Should have stripped these + expect(newModel.body).toBeUndefined(); + expect(newModel.encoding).toBeUndefined(); }); it('migrates base64 body correctly', async () => { diff --git a/app/models/index.js b/app/models/index.js index 9595e890d..29891dbf5 100644 --- a/app/models/index.js +++ b/app/models/index.js @@ -99,7 +99,7 @@ export function initModel (type: string, ...sources: Array) { created: Date.now() }, model.init()); - const fullObject = Object.assign(objectDefaults, ...sources); + const fullObject = Object.assign({}, objectDefaults, ...sources); // Generate an _id if there isn't one yet if (!fullObject._id) { diff --git a/app/templating/base-extension.js b/app/templating/base-extension.js index 57aa5a3a3..7cf666a7f 100644 --- a/app/templating/base-extension.js +++ b/app/templating/base-extension.js @@ -73,7 +73,9 @@ export default class BaseExtension { models: { request: {getById: models.request.getById}, workspace: {getById: models.workspace.getById}, - cookieJar: {getOrCreateForWorkspace: models.cookieJar.getOrCreateForWorkspace}, + cookieJar: {getOrCreateForWorkspace: workspace => { + return models.cookieJar.getOrCreateForParentId(workspace._id); + }}, response: { getLatestForRequestId: models.response.getLatestForRequest, getBodyBuffer: models.response.getBodyBuffer diff --git a/app/templating/extensions/request-extension.js b/app/templating/extensions/request-extension.js index 9bd565807..0f6fe8118 100644 --- a/app/templating/extensions/request-extension.js +++ b/app/templating/extensions/request-extension.js @@ -54,7 +54,7 @@ export default { case 'url': return getRequestUrl(context, request); case 'cookie': - const cookieJar = await context.util.models.cookieJar.getOrCreateForParentId(workspace._id); + const cookieJar = await context.util.models.cookieJar.getOrCreateForWorkspace(workspace); const url = await getRequestUrl(context, request); const value = await getCookieValue(cookieJar, url, name); return value; diff --git a/app/ui/components/wrapper.js b/app/ui/components/wrapper.js index 0f30fe491..c559d91c7 100644 --- a/app/ui/components/wrapper.js +++ b/app/ui/components/wrapper.js @@ -9,7 +9,7 @@ import {updateMimeType} from '../../models/request'; import React from 'react'; import autobind from 'autobind-decorator'; import classnames from 'classnames'; -import {registerModal, reloadModal, showModal} from './modals/index'; +import {registerModal, showModal} from './modals/index'; import AlertModal from './modals/alert-modal'; import ChangelogModal from './modals/changelog-modal'; import CookiesModal from './modals/cookies-modal'; diff --git a/app/ui/redux/selectors.js b/app/ui/redux/selectors.js index ed46e8b9f..2c7930a93 100644 --- a/app/ui/redux/selectors.js +++ b/app/ui/redux/selectors.js @@ -1,6 +1,5 @@ import {createSelector} from 'reselect'; import {fuzzyMatch} from '../../common/misc'; -import * as models from '../../models/index'; // ~~~~~~~~~ // // Selectors //