From 6b3dee759d29a0e98df737d6ba899fc20989105c Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 7 May 2019 14:08:57 -0400 Subject: [PATCH] More robust handling of prompt tag filtering --- plugins/insomnia-plugin-prompt/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/insomnia-plugin-prompt/index.js b/plugins/insomnia-plugin-prompt/index.js index 013fed2279..5dc673416d 100644 --- a/plugins/insomnia-plugin-prompt/index.js +++ b/plugins/insomnia-plugin-prompt/index.js @@ -4,7 +4,13 @@ module.exports.responseHooks = [ async context => { const items = await context.store.all(); const requestId = context.request.getId(); - const toRemove = items.filter(v => v.key.indexOf(requestId) === 0); + const toRemove = items.filter(v => { + if (v.key && typeof v.key === 'string') { + return v.key.indexOf(requestId) === 0; + } + + return false; + }); // Delete cached values we prompt again on the next request for (const { key } of toRemove) { await context.store.removeItem(key);