Comparing version 2.1.1 to 2.1.2
@@ -32,2 +32,6 @@ 'use strict'; | ||
var _isStream = require('is-stream'); | ||
var _isStream2 = _interopRequireDefault(_isStream); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -231,6 +235,9 @@ | ||
return new Promise((resolve, reject) => { | ||
let request = this.http.request(this, resolve); | ||
request.on('error', reject); | ||
if (this.requestBody) request.write(this.requestBody); | ||
request.end(); | ||
this.request = this.http.request(this, resolve); | ||
this.request.on('error', reject); | ||
if (_isStream2.default.readable(this.requestBody)) { | ||
this.requestBody.pipe(this.request); | ||
} else { | ||
this.request.end(this.requestBody); | ||
} | ||
}); | ||
@@ -245,2 +252,6 @@ } | ||
parseBody(body) { | ||
if (_isStream2.default.readable(body)) { | ||
this.requestBody = body; | ||
return; | ||
} | ||
if (!this.headers['Content-Type']) { | ||
@@ -247,0 +258,0 @@ this.headers['Content-Type'] = 'application/json'; |
{ | ||
"name": "http-call", | ||
"description": "make http requests", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"author": "Jeff Dickey @dickeyxxx", | ||
@@ -10,2 +10,3 @@ "bugs": "https://github.com/dickeyxxx/http-call/issues", | ||
"is-retry-allowed": "^1.1.0", | ||
"is-stream": "^1.1.0", | ||
"tunnel-agent": "^0.6.0" | ||
@@ -15,3 +16,3 @@ }, | ||
"babel-cli": "6.24.1", | ||
"babel-core": "6.24.1", | ||
"babel-core": "^6.25.0", | ||
"babel-eslint": "7.2.3", | ||
@@ -68,2 +69,3 @@ "babel-jest": "20.0.3", | ||
"http$IncomingMessage", | ||
"http$ClientRequest", | ||
"$Diff", | ||
@@ -70,0 +72,0 @@ "$Shape" |
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
22572
327
4
+ Addedis-stream@^1.1.0
+ Addedis-stream@1.1.0(transitive)