This commit is contained in:
Gregory Schier
2024-08-26 13:10:22 -07:00
parent 7ca3b9bd20
commit d4baddc8d4
19 changed files with 49 additions and 48 deletions

View File

@@ -9,7 +9,7 @@
"version": "0.0.1",
"dependencies": {
"@xmldom/xmldom": "^0.8.10",
"@yaakapp/api": "^0.1.12",
"@yaakapp/api": "^0.1.13",
"jsonpath-plus": "^9.0.0",
"xpath": "^0.0.34"
},
@@ -741,9 +741,9 @@
}
},
"node_modules/@yaakapp/api": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/@yaakapp/api/-/api-0.1.12.tgz",
"integrity": "sha512-qA+2BBZz1LGTi0wsOmlwaw6xJbE3elPIUMt/BkiRT+DqQC5spZtISsyoPXjtsM0xZc2orjoRJd0LesXH7xkD0g==",
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/@yaakapp/api/-/api-0.1.13.tgz",
"integrity": "sha512-FSYPHZV0mP967w63VXi9zYP81hPo3vjSW3/UElJLuF/8ig6WmG4p1q2oYos4Ik267Z3qSQAGN5dPMfuk3DAnBA==",
"dependencies": {
"@types/node": "^22.0.0"
}

View File

@@ -6,7 +6,7 @@
"build": "yaakcli src/index.ts"
},
"dependencies": {
"@yaakapp/api": "^0.1.12",
"@yaakapp/api": "^0.1.13",
"jsonpath-plus": "^9.0.0",
"xpath": "^0.0.34",
"@xmldom/xmldom": "^0.8.10"

View File

@@ -27,7 +27,6 @@ export const plugin: Plugin = {
options: [
{ name: 'When no responses', value: 'smart' },
{ name: 'Always', value: 'always' },
{ name: 'Never', value: 'never' },
],
},
],
@@ -40,7 +39,7 @@ export const plugin: Plugin = {
if (httpRequest == null) {
return null;
}
const renderedHttpRequest = await ctx.httpRequest.render({ httpRequest });
const renderedHttpRequest = await ctx.httpRequest.render({ httpRequest, purpose: args.purpose });
const responses = await ctx.httpResponse.find({ requestId: httpRequest.id, limit: 1 });
@@ -52,7 +51,9 @@ export const plugin: Plugin = {
// Previews happen a ton, and we don't want to send too many times on "always," so treat
// it as "smart" during preview.
let behavior = args.values.behavior === 'always' && args.purpose === 'preview' ? 'smart' : args.values.behavior;
let behavior = (args.values.behavior === 'always' && args.purpose === 'preview')
? 'smart'
: args.values.behavior;
// Send if no responses and "smart," or "always"
if ((behavior === 'smart' && response == null) || behavior === 'always') {