Comparing version 5.3.0 to 5.3.1
20
index.js
@@ -8,3 +8,4 @@ 'use strict'; | ||
var objectAssign = require('object-assign'); | ||
var duplexify = require('duplexify'); | ||
var PassThrough = require('readable-stream').PassThrough; | ||
var duplexer2 = require('duplexer2'); | ||
var isStream = require('is-stream'); | ||
@@ -144,3 +145,5 @@ var readAllStream = require('read-all-stream'); | ||
function asStream(opts) { | ||
var proxy = duplexify(); | ||
var input = new PassThrough(); | ||
var output = new PassThrough(); | ||
var proxy = duplexer2(input, output); | ||
@@ -173,3 +176,3 @@ if (opts.json) { | ||
if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') { | ||
proxy.setWritable(req); | ||
input.pipe(req); | ||
return; | ||
@@ -184,3 +187,3 @@ } | ||
proxy.setReadable(res); | ||
res.pipe(output); | ||
@@ -335,4 +338,9 @@ if (statusCode < 200 || statusCode > 299) { | ||
helpers.forEach(function (el) { | ||
got.stream[el] = function (url, opts) { | ||
return got.stream(url, objectAssign({}, opts, {method: el.toUpperCase()})); | ||
got.stream[el] = function (url, opts, cb) { | ||
if (typeof opts === 'function') { | ||
cb = opts; | ||
opts = {}; | ||
} | ||
return got.stream(url, objectAssign({}, opts, {method: el.toUpperCase()}), cb); | ||
}; | ||
@@ -339,0 +347,0 @@ }); |
{ | ||
"name": "got", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"description": "Simplified HTTP/HTTPS requests", | ||
@@ -49,3 +49,3 @@ "license": "MIT", | ||
"create-error-class": "^2.0.0", | ||
"duplexify": "^3.2.0", | ||
"duplexer2": "^0.1.4", | ||
"is-plain-obj": "^1.0.0", | ||
@@ -60,2 +60,3 @@ "is-redirect": "^1.0.0", | ||
"read-all-stream": "^3.0.0", | ||
"readable-stream": "^2.0.5", | ||
"timed-out": "^2.0.0", | ||
@@ -62,0 +63,0 @@ "unzip-response": "^1.0.0", |
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
19891
297
15
+ Addedduplexer2@^0.1.4
+ Addedreadable-stream@^2.0.5
+ Addedduplexer2@0.1.4(transitive)
- Removedduplexify@^3.2.0
- Removedduplexify@3.7.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedonce@1.4.0(transitive)
- Removedstream-shift@1.0.3(transitive)
- Removedwrappy@1.0.2(transitive)