postman-runtime 7.31.1 → 7.31.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.
@@ -113,6 +113,19 @@ var _ = require('lodash'),
113
113
  }
114
114
 
115
115
  return offset;
116
+ },
117
+
118
+ /**
119
+ * Checks if the response is a server sent event stream.
120
+ *
121
+ * @param {Object} headers - Response headers
122
+ * @returns {Boolean}
123
+ */
124
+ isSSEStream = function (headers) {
125
+ return String(headers.get('content-type'))
126
+ .split(';')[0]
127
+ .trim()
128
+ .toLowerCase() === 'text/event-stream';
116
129
  };
117
130
 
118
131
  class Requester extends EventEmitter {
@@ -361,8 +374,7 @@ class Requester extends EventEmitter {
361
374
  header: responseHeaders
362
375
  });
363
376
 
364
- self.isSSEStream = String(sdkResponse.headers.get('content-type'))
365
- .toLowerCase() === 'text/event-stream';
377
+ self.isSSEStream = isSSEStream(sdkResponse.headers);
366
378
 
367
379
  // prepare history from request debug data
368
380
  history = getExecutionHistory(_.get(response, 'request._debug'));
@@ -14,7 +14,7 @@ function hasBom (buf) {
14
14
  }
15
15
 
16
16
  // Adapted from https://github.com/EventSource/eventsource
17
- class SSEStream {
17
+ class SSEProcessor {
18
18
  constructor (emit) {
19
19
  this.emit = emit;
20
20
 
@@ -126,4 +126,4 @@ class SSEStream {
126
126
  }
127
127
  }
128
128
 
129
- module.exports = SSEStream;
129
+ module.exports = SSEProcessor;
@@ -153,7 +153,8 @@ module.exports = {
153
153
  }
154
154
 
155
155
  sandbox.createContext(_.merge({
156
- timeout: _(run.options.timeout).pick(['script', 'global']).values().min()
156
+ timeout: _(run.options.timeout).pick(['script', 'global']).values().min(),
157
+ serializeLogs: _.get(run, 'options.script.serializeLogs')
157
158
  // debug: true
158
159
  }, run.options.host), function (err, context) {
159
160
  if (err) { return done(err); }
@@ -431,7 +432,6 @@ module.exports = {
431
432
  timeout: payload.scriptTimeout, // @todo: Expose this as a property in Collection SDK's Script
432
433
  cursor: scriptCursor,
433
434
  context: _.pick(payload.context, SAFE_CONTEXT_VARIABLES),
434
- serializeLogs: _.get(this, 'options.script.serializeLogs'),
435
435
 
436
436
  // legacy options
437
437
  legacy: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postman-runtime",
3
- "version": "7.31.1",
3
+ "version": "7.31.3",
4
4
  "description": "Underlying library of executing Postman Collections",
5
5
  "author": "Postman Inc.",
6
6
  "license": "Apache-2.0",
@@ -55,7 +55,7 @@
55
55
  "performance-now": "2.1.0",
56
56
  "postman-collection": "4.1.7",
57
57
  "postman-request": "2.88.1-postman.32",
58
- "postman-sandbox": "4.2.3",
58
+ "postman-sandbox": "4.2.4",
59
59
  "postman-url-encoder": "3.0.5",
60
60
  "serialised-error": "1.1.3",
61
61
  "uuid": "8.3.2"