Comparing version 1.1.0 to 1.1.1
@@ -1,2 +0,2 @@ | ||
var Promise, S, addErrorData, bhttpAPI, bhttpErrors, concatStream, createCookieJar, debug, debugRequest, debugResponse, doPayloadRequest, doRedirect, errors, extend, formData, formFixArray, http, https, isStream, makeRequest, ofTypes, packageConfig, prepareCleanup, prepareDefaults, prepareOptions, preparePayload, prepareProtocol, prepareRequest, prepareSession, prepareUrl, processResponse, querystring, redirectGet, redirectUnchanged, sink, spy, stream, streamLength, toughCookie, urlUtil, util, _; | ||
var Promise, S, addErrorData, bhttpAPI, bhttpErrors, concatStream, createCookieJar, debug, debugRequest, debugResponse, devNull, doPayloadRequest, doRedirect, errors, extend, formData, formFixArray, http, https, isStream, makeRequest, ofTypes, packageConfig, prepareCleanup, prepareDefaults, prepareOptions, preparePayload, prepareProtocol, prepareRequest, prepareSession, prepareUrl, processResponse, querystring, redirectGet, redirectUnchanged, sink, spy, stream, streamLength, toughCookie, urlUtil, util, _; | ||
@@ -33,2 +33,4 @@ urlUtil = require("url"); | ||
devNull = require("dev-null"); | ||
formData = require("form-data2"); | ||
@@ -491,3 +493,3 @@ | ||
} else if (request.responseOptions.discardResponse) { | ||
response.resume(); | ||
response.pipe(devNull()); | ||
return Promise.resolve(response); | ||
@@ -510,4 +512,24 @@ } else { | ||
return new Promise(function(resolve, reject) { | ||
response.pipe(progressStream); | ||
response.pause(); | ||
var attachProgressStream, _on, _progressStreamAttached, _resume; | ||
_resume = response.resume.bind(response); | ||
_on = response.on.bind(response); | ||
_progressStreamAttached = false; | ||
attachProgressStream = function() { | ||
if (!_progressStreamAttached) { | ||
debugResponse("attaching progress stream"); | ||
_progressStreamAttached = true; | ||
return response.pipe(progressStream); | ||
} | ||
}; | ||
response.on = function(eventName, handler) { | ||
debugResponse("'on' called, " + eventName); | ||
if (eventName === "data" || eventName === "readable") { | ||
attachProgressStream(); | ||
} | ||
return _on(eventName, handler); | ||
}; | ||
response.resume = function() { | ||
attachProgressStream(); | ||
return _resume(); | ||
}; | ||
if (request.responseOptions.stream) { | ||
@@ -579,3 +601,3 @@ return resolve(response); | ||
if (!request.responseOptions.keepRedirectResponses) { | ||
response.resume(); | ||
response.pipe(devNull()); | ||
} | ||
@@ -582,0 +604,0 @@ requestState.redirectHistory.push(response); |
{ | ||
"name": "bhttp", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A sane HTTP client library for Node.js with Streams2 support.", | ||
@@ -28,2 +28,3 @@ "main": "index.js", | ||
"debug": "^2.1.1", | ||
"dev-null": "^0.1.1", | ||
"errors": "^0.2.0", | ||
@@ -30,0 +31,0 @@ "extend": "^2.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3149532
16
746
14
+ Addeddev-null@^0.1.1
+ Addeddev-null@0.1.1(transitive)