insomnia-plugin-request
Advanced tools
Comparing version 1.0.15 to 1.0.16
@@ -19,5 +19,3 @@ const { jarFromCookies, cookiesFromJar } = require('insomnia-cookies'); | ||
const cookies = await cookiesFromJar(jar); | ||
const requests = [ | ||
{ _id: 'req_1', parameters: [], url: 'https://insomnia.rest/foo/bar' } | ||
]; | ||
const requests = [{ _id: 'req_1', parameters: [], url: 'https://insomnia.rest/foo/bar' }]; | ||
const jars = [{ _id: 'jar_1', parentId: 'wrk_1', cookies }]; | ||
@@ -24,0 +22,0 @@ const context = _getTestContext([{ _id: 'wrk_1' }], requests, jars); |
26
index.js
@@ -52,4 +52,3 @@ const { | ||
type: 'string', | ||
hide: args => | ||
['url', 'oauth2', 'name', 'folder'].includes(args[0].value), | ||
hide: args => ['url', 'oauth2', 'name', 'folder'].includes(args[0].value), | ||
displayName: args => { | ||
@@ -69,4 +68,3 @@ switch (args[0].value) { | ||
displayName: 'Parent Index', | ||
help: | ||
'Specify an index (Starting at 0) for how high up the folder tree to look', | ||
help: 'Specify an index (Starting at 0) for how high up the folder tree to look', | ||
type: 'number' | ||
@@ -84,5 +82,3 @@ } | ||
const request = await context.util.models.request.getById(meta.requestId); | ||
const workspace = await context.util.models.workspace.getById( | ||
meta.workspaceId | ||
); | ||
const workspace = await context.util.models.workspace.getById(meta.workspaceId); | ||
@@ -105,5 +101,3 @@ if (!request) { | ||
const cookieJar = await context.util.models.cookieJar.getOrCreateForWorkspace( | ||
workspace | ||
); | ||
const cookieJar = await context.util.models.cookieJar.getOrCreateForWorkspace(workspace); | ||
const url = await getRequestUrl(context, request); | ||
@@ -131,9 +125,5 @@ return getCookieValue(cookieJar, url, name); | ||
const namesStr = names.map(n => `"${n}"`).join(',\n\t'); | ||
throw new Error( | ||
`No header with name "${name}".\nChoices are [\n\t${namesStr}\n]` | ||
); | ||
throw new Error(`No header with name "${name}".\nChoices are [\n\t${namesStr}\n]`); | ||
case 'oauth2': | ||
const token = await context.util.models.oAuth2Token.getByRequestId( | ||
request._id | ||
); | ||
const token = await context.util.models.oAuth2Token.getByRequestId(request._id); | ||
if (!token) { | ||
@@ -146,5 +136,3 @@ throw new Error('No OAuth 2.0 tokens found for request'); | ||
case 'folder': | ||
const ancestors = await context.util.models.request.getAncestors( | ||
request | ||
); | ||
const ancestors = await context.util.models.request.getAncestors(request); | ||
const doc = ancestors[folderIndex || 0]; | ||
@@ -151,0 +139,0 @@ if (!doc) { |
{ | ||
"name": "insomnia-plugin-request", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"author": "Gregory Schier <gschier1990@gmail.com>", | ||
@@ -19,6 +19,6 @@ "description": "Insomnia request template tag", | ||
"dependencies": { | ||
"insomnia-cookies": "^0.0.10", | ||
"insomnia-url": "^0.1.4" | ||
"insomnia-cookies": "^0.0.11", | ||
"insomnia-url": "^0.1.5" | ||
}, | ||
"gitHead": "2805a5f9fed4a804b9615ec82463b90f865c38ff" | ||
"gitHead": "d0652a5b918564e19980afe6905027f7c8fda522" | ||
} |
10513
267
+ Addedinsomnia-cookies@0.0.11(transitive)
- Removedinsomnia-cookies@0.0.10(transitive)
Updatedinsomnia-cookies@^0.0.11
Updatedinsomnia-url@^0.1.5