insomnia-plugin-request
Advanced tools
Comparing version 2.2.24 to 2.2.34-beta.0
40
index.js
@@ -49,6 +49,17 @@ const { | ||
{ | ||
displayName: 'OAuth 2.0 Token', | ||
displayName: 'OAuth 2.0 Access Token', | ||
value: 'oauth2', | ||
description: 'access token', | ||
/* | ||
This value is left as is and not renamed to 'oauth2-access' so as to not | ||
break the current release's usage of `oauth2`. | ||
*/ | ||
}, | ||
{ | ||
displayName: 'OAuth 2.0 Identity Token', | ||
value: 'oauth2-identity', | ||
}, | ||
{ | ||
displayName: 'OAuth 2.0 Refresh Token', | ||
value: 'oauth2-refresh', | ||
}, | ||
], | ||
@@ -58,3 +69,6 @@ }, | ||
type: 'string', | ||
hide: args => ['url', 'oauth2', 'name', 'folder'].includes(args[0].value), | ||
hide: args => | ||
['url', 'oauth2', 'oauth2-identity', 'oauth2-refresh', 'name', 'folder'].includes( | ||
args[0].value, | ||
), | ||
displayName: args => { | ||
@@ -155,7 +169,19 @@ switch (args[0].value) { | ||
case 'oauth2': | ||
const token = await context.util.models.oAuth2Token.getByRequestId(request._id); | ||
if (!token) { | ||
throw new Error('No OAuth 2.0 tokens found for request'); | ||
const access = await context.util.models.oAuth2Token.getByRequestId(request._id); | ||
if (!access || !access.accessToken) { | ||
throw new Error('No OAuth 2.0 access tokens found for request'); | ||
} | ||
return token.accessToken; | ||
return access.accessToken; | ||
case 'oauth2-identity': | ||
const identity = await context.util.models.oAuth2Token.getByRequestId(request._id); | ||
if (!identity || !identity.identityToken) { | ||
throw new Error('No OAuth 2.0 identity tokens found for request'); | ||
} | ||
return identity.identityToken; | ||
case 'oauth2-refresh': | ||
const refresh = await context.util.models.oAuth2Token.getByRequestId(request._id); | ||
if (!refresh || !refresh.refreshToken) { | ||
throw new Error('No OAuth 2.0 refresh tokens found for request'); | ||
} | ||
return refresh.refreshToken; | ||
case 'name': | ||
@@ -162,0 +188,0 @@ return request.name; |
{ | ||
"name": "insomnia-plugin-request", | ||
"version": "2.2.24", | ||
"version": "2.2.34-beta.0", | ||
"author": "Gregory Schier <greg.schier@konghq.com>", | ||
@@ -21,6 +21,6 @@ "description": "Insomnia request template tag", | ||
"dependencies": { | ||
"insomnia-cookies": "^2.2.24", | ||
"insomnia-url": "^2.2.24" | ||
"insomnia-cookies": "2.2.34-beta.0", | ||
"insomnia-url": "2.2.34-beta.0" | ||
}, | ||
"gitHead": "c2d989e1e004b3965bed650354bc31feca4b582e" | ||
"gitHead": "5e7143058700e9f7a2f833d93e55ca67eaa77326" | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13731
348
2
+ Addedinsomnia-cookies@2.2.34-beta.0(transitive)
+ Addedinsomnia-url@2.2.34-beta.0(transitive)
- Removedinsomnia-cookies@2.8.0(transitive)
- Removedinsomnia-url@2.8.0(transitive)
Updatedinsomnia-url@2.2.34-beta.0