diff --git a/app/templating/extensions/__tests__/response-extension.test.js b/app/templating/extensions/__tests__/response-extension.test.js index 44d6254de..1cbdb5fc7 100644 --- a/app/templating/extensions/__tests__/response-extension.test.js +++ b/app/templating/extensions/__tests__/response-extension.test.js @@ -27,10 +27,11 @@ describe('ResponseExtension General', async () => { }); it('fails on empty filter', async () => { - await models.response.create({parentId: 'req_test'}, '{"foo": "bar"}'); + const request = await models.request.create({parentId: 'foo'}); + await models.response.create({parentId: request._id, statusCode: 200}, '{"foo": "bar"}'); try { - await templating.render(`{% response "body", "req_test", "" %}`); + await templating.render(`{% response "body", "${request._id}", "" %}`); fail('Should have failed'); } catch (err) { expect(err.message).toContain('No body filter specified'); diff --git a/app/templating/extensions/response-extension.js b/app/templating/extensions/response-extension.js index 21066882f..286513b8a 100644 --- a/app/templating/extensions/response-extension.js +++ b/app/templating/extensions/response-extension.js @@ -49,10 +49,6 @@ export default ({ throw new Error('No request specified'); } - if (field !== 'raw' && !filter) { - throw new Error(`No ${field} filter specified`); - } - const request = await context.util.models.request.getById(id); if (!request) { throw new Error(`Could not find request ${id}`); @@ -65,7 +61,11 @@ export default ({ } if (!response.statusCode) { - throw new Error('No responses for request'); + throw new Error('No successful responses for request'); + } + + if (field !== 'raw' && !filter) { + throw new Error(`No ${field} filter specified`); } const sanitizedFilter = filter.trim(); diff --git a/app/templating/utils.js b/app/templating/utils.js index 7984b1eb1..74b1c0b5c 100644 --- a/app/templating/utils.js +++ b/app/templating/utils.js @@ -3,6 +3,7 @@ export type NunjucksParsedTagArg = { type: 'string' | 'number' | 'boolean' | 'number' | 'variable' | 'expression', value: string | number | boolean, + forceVariable?: boolean, quotedBy?: '"' | "'" }; diff --git a/app/ui/components/cookie-list.js b/app/ui/components/cookie-list.js index 1836b138b..5409bb762 100644 --- a/app/ui/components/cookie-list.js +++ b/app/ui/components/cookie-list.js @@ -67,13 +67,16 @@ class CookieList extends React.PureComponent { return ( - - {cookie.domain} - - - {cookieString} - + + + {cookie.domain} + + + + + {cookieString} + +