New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

insomnia-plugin-response

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

insomnia-plugin-response - npm Package Compare versions

Comparing version 1.0.21 to 1.0.22

17

__tests__/index.test.js

@@ -195,3 +195,3 @@ const tag = require('..').templateTags[0];

describe('XPath', async () => {
describe('XPath', () => {
it('renders basic response "body" query', async () => {

@@ -347,3 +347,3 @@ const requests = [{ _id: 'req_1', parentId: 'wrk_1' }];

describe('ResponseExtension Header', async () => {
describe('ResponseExtension Header', () => {
it('renders basic response "header"', async () => {

@@ -404,3 +404,3 @@ const requests = [{ _id: 'req_1', parentId: 'wrk_1' }];

describe('Raw', async () => {
describe('Raw', () => {
it('renders basic response', async () => {

@@ -434,3 +434,14 @@ const requests = [{ _id: 'req_1', parentId: 'wrk_1' }];

}
const store = {};
return {
store: {
hasItem: key => store.hasOwnProperty(key),
getItem: key => store[key],
removeItem: key => {
delete store[key];
},
setItem: (key, value) => {
store[key] = value;
},
},
util: {

@@ -437,0 +448,0 @@ models: {

22

index.js

@@ -39,2 +39,3 @@ const jq = require('jsonpath');

type: 'string',
encoding: 'base64',
hide: args => args[0].value === 'raw',

@@ -95,15 +96,24 @@ displayName: args => {

// Make sure we only send the request once per render so we don't have infinite recursion
const recursiveStorageKey = `request.${request._id}`;
if (await context.store.hasItem(recursiveStorageKey)) {
console.log('[response tag] Preventing recursive render');
return null;
}
let shouldResend = false;
if (resendBehavior === 'always') {
if (resendBehavior === 'never') {
shouldResend = false;
} else if (resendBehavior === 'no-history') {
shouldResend = !response;
} else if (resendBehavior === 'always') {
shouldResend = true;
} else if (resendBehavior === 'no-history' && !response) {
shouldResend = true;
} else if (resendBehavior === 'never') {
shouldResend = false;
}
// Resend dependent request if needed but only if we're rendering for a send
if (shouldResend && (!response || context.renderPurpose === 'send')) {
if (shouldResend && context.renderPurpose === 'send') {
console.log('[response tag] Resending dependency');
await context.store.setItem(recursiveStorageKey, 'true');
response = await context.network.sendRequest(request);
await context.store.removeItem(recursiveStorageKey);
}

@@ -110,0 +120,0 @@

{
"name": "insomnia-plugin-response",
"version": "1.0.21",
"version": "1.0.22",
"author": "Gregory Schier <gschier1990@gmail.com>",

@@ -23,3 +23,3 @@ "description": "Insomnia response template tag",

},
"gitHead": "87651b3bc63fc6d3966ea857cff895a09c388c54"
"gitHead": "20ef8015c5f7b333bc73963d589b2cf16d6c3910"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc