postman-runtime 7.36.2 → 7.36.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -169,38 +169,23 @@ module.exports = {
169
169
  }, run.options.host), function (err, context) {
170
170
  if (err) { return done(err); }
171
171
 
172
- const originalContextOnHandler = context.on;
173
-
174
- // We are overriding the context.on method to ensure for executions
175
- // that are skipped, we don't trigger any events.
176
- context.on = function (eventName, handler) {
177
- originalContextOnHandler.call(context, eventName, function () {
178
- const cursor = arguments && arguments[0];
179
-
180
- if (cursor && cursor.execution && isExecutionSkipped(cursor.execution)) { return; }
181
-
182
- handler.apply(context, arguments);
183
- });
184
- };
185
-
186
172
  // store the host in run object for future use and move on
187
173
  run.host = context;
188
174
 
189
- context.on('console', function () {
190
- run.triggers.console(...arguments);
191
- });
175
+ const triggerHandler = function (eventName) {
176
+ return function () {
177
+ const executionId = arguments && arguments[0] && arguments[0].execution;
192
178
 
193
- context.on('error', function () {
194
- run.triggers.error(...arguments);
195
- });
179
+ if (isExecutionSkipped(executionId)) { return; }
196
180
 
197
- context.on('execution.error', function () {
198
- run.triggers.exception(...arguments);
199
- });
181
+ run.triggers[eventName](...arguments);
182
+ };
183
+ };
200
184
 
201
- context.on('execution.assertion', function () {
202
- run.triggers.assertion(...arguments);
203
- });
185
+ context.on('console', triggerHandler('console'));
186
+ context.on('error', triggerHandler('error'));
187
+ context.on('execution.error', triggerHandler('exception'));
188
+ context.on('execution.assertion', triggerHandler('assertion'));
204
189
 
205
190
  done();
206
191
  });
@@ -480,6 +465,7 @@ module.exports = {
480
465
  this.host.removeAllListeners(EXECUTION_RESPONSE_EVENT_BASE + executionId);
481
466
  this.host.removeAllListeners(EXECUTION_COOKIES_EVENT_BASE + executionId);
482
467
  this.host.removeAllListeners(EXECUTION_ERROR_EVENT_BASE + executionId);
468
+ this.host.removeAllListeners(EXECUTION_SKIP_REQUEST_EVENT_BASE + executionId);
483
469
 
484
470
  // Handle async errors as well.
485
471
  // If there was an error running the script itself, that takes precedence
@@ -33,24 +33,28 @@ var _ = require('lodash'),
33
33
 
34
34
  hasVaultSecrets = payload.vaultSecrets.values.count() > 0,
35
35
 
36
+ urlObj = context.item.request.url,
36
37
  // @note URL string is used to resolve nested variables as URL parser doesn't support them well.
37
- urlString = context.item.request.url.toString(),
38
+ urlString = urlObj.toString(),
38
39
  unresolvedUrlString = urlString,
39
40
 
40
41
  vaultVariables,
42
+ vaultUrl,
41
43
  item,
42
44
  auth;
43
45
 
44
46
  if (hasVaultSecrets) {
45
47
  // get the vault variables that match the unresolved URL string
46
- vaultVariables = payload.vaultSecrets.__getMatchingVariables(urlString);
48
+ vaultUrl = urlObj.protocol ? urlString : `http://${urlString}`; // force protocol
49
+ vaultVariables = payload.vaultSecrets.__getMatchingVariables(vaultUrl);
47
50
 
48
51
  // resolve variables in URL string with initial vault variables
49
52
  urlString = sdk.Property.replaceSubstitutions(urlString, [...variableDefinitions, vaultVariables]);
50
53
 
51
54
  if (urlString !== unresolvedUrlString) {
52
55
  // get the final list of vault variables that match the resolved URL string
53
- vaultVariables = payload.vaultSecrets.__getMatchingVariables(urlString);
56
+ vaultUrl = new sdk.Url(urlString).toString(true);
57
+ vaultVariables = payload.vaultSecrets.__getMatchingVariables(vaultUrl);
54
58
 
55
59
  // resolve vault variables in URL string
56
60
  // @note other variable scopes are skipped as they are already resolved
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postman-runtime",
3
- "version": "7.36.2",
3
+ "version": "7.36.3",
4
4
  "description": "Underlying library of executing Postman Collections",
5
5
  "author": "Postman Inc.",
6
6
  "license": "Apache-2.0",
@@ -48,7 +48,7 @@
48
48
  "handlebars": "4.7.8",
49
49
  "httpntlm": "1.8.13",
50
50
  "jose": "4.14.4",
51
- "js-sha512": "0.8.0",
51
+ "js-sha512": "0.9.0",
52
52
  "lodash": "4.17.21",
53
53
  "mime-types": "2.1.35",
54
54
  "node-forge": "1.3.1",