whistle 2.10.8 → 2.10.9

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.
package/lib/config.js CHANGED
@@ -223,10 +223,6 @@ function createAgent(agentConfig, https) {
223
223
  return agent;
224
224
  }
225
225
 
226
- function capitalize(str) {
227
- return (str && str[0].toUpperCase()) + str.substring(1);
228
- }
229
-
230
226
  function getHttpsAgent(options, reqOpts) {
231
227
  var key = getCacheKey(options);
232
228
  var agent = httpsAgents.get(key);
@@ -234,7 +230,7 @@ function getHttpsAgent(options, reqOpts) {
234
230
  var headers = options.headers || {};
235
231
  var proxyHeaders = {};
236
232
  Object.keys(headers).forEach(function (key) {
237
- var rawKey = key.split('-').map(capitalize).join('-');
233
+ var rawKey = key.split('-').map(common.upperFirst).join('-');
238
234
  proxyHeaders[rawKey] = headers[key];
239
235
  });
240
236
  reqOpts._tunnelProxyHeaders = proxyHeaders;
package/lib/index.js CHANGED
@@ -250,7 +250,7 @@ function handleGlobalException(err) {
250
250
  code === 'ERR_HTTP_TRAILER_INVALID' ||
251
251
  code === 'ERR_INTERNAL_ASSERTION' ||
252
252
  code === 'ERR_INVALID_ARG_TYPE' ||
253
- (err && /finishwrite|'_hadError'/i.test(err.message)))
253
+ (err && /finishwrite|'_hadError'|shouldUpgradeCallback/i.test(err.message)))
254
254
  ) {
255
255
  return;
256
256
  }
@@ -332,7 +332,7 @@ function emitDataEvents(req, res, proxy) {
332
332
  var headers = info.headers;
333
333
  captureStream = requestTime == null || enable.captureStream;
334
334
  if (headers) {
335
- isSse = headers['content-type'] === 'text/event-stream';
335
+ isSse = util.trimType(headers['content-type']) === 'text/event-stream';
336
336
  captureStream = captureStream || isSse;
337
337
  resSepInfo = parseFrameSep(headers);
338
338
  if (resSepInfo && resSepInfo.sep) {
package/lib/util/index.js CHANGED
@@ -1478,9 +1478,11 @@ exports.getUrlValue = function(rule) {
1478
1478
  };
1479
1479
 
1480
1480
  function _getRawType(type) {
1481
- return typeof type === 'string' ? type.split(';')[0].toLowerCase() : '';
1481
+ return typeof type === 'string' ? type.split(';')[0].trim().toLowerCase() : '';
1482
1482
  }
1483
1483
 
1484
+ exports.trimType = _getRawType;
1485
+
1484
1486
  function getRawType(data) {
1485
1487
  return _getRawType(data.headers && data.headers['content-type']);
1486
1488
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "whistle",
3
3
  "description": "HTTP, HTTP2, HTTPS, Websocket debugging proxy",
4
- "version": "2.10.8",
4
+ "version": "2.10.9",
5
5
  "dataDirname": ".whistle",
6
6
  "localUIHost": "local.whistlejs.com",
7
7
  "port": 8899,