simple-get
Advanced tools
Comparing version 1.3.3 to 1.3.4
22
index.js
@@ -7,3 +7,3 @@ module.exports = simpleGet | ||
var url = require('url') | ||
var zlib = require('zlib') | ||
var unzipResponse = require('unzip-response') | ||
@@ -46,21 +46,3 @@ function simpleGet (opts, cb) { | ||
// Support gzip/deflate | ||
if (['gzip', 'deflate'].indexOf(res.headers['content-encoding']) !== -1) { | ||
// Pipe the response through an unzip stream (gunzip, inflate) and wrap it so it | ||
// looks like an `http.IncomingMessage`. | ||
var stream = zlib.createUnzip() | ||
res.pipe(stream) | ||
res.on('close', function () { stream.emit('close') }) | ||
stream.httpVersion = res.httpVersion | ||
stream.headers = res.headers | ||
stream.trailers = res.trailers | ||
stream.setTimeout = res.setTimeout.bind(res) | ||
stream.method = res.method | ||
stream.url = res.url | ||
stream.statusCode = res.statusCode | ||
stream.socket = res.socket | ||
cb(null, stream) | ||
} else { | ||
cb(null, res) | ||
} | ||
cb(null, unzipResponse(res)) | ||
}) | ||
@@ -67,0 +49,0 @@ req.on('error', cb) |
{ | ||
"name": "simple-get", | ||
"description": "Simplest way to make http get requests. Supports HTTPS, redirects, gzip/deflate, streams in < 100 lines.", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"author": { | ||
@@ -14,3 +14,4 @@ "name": "Feross Aboukhadijeh", | ||
"dependencies": { | ||
"once": "^1.3.1" | ||
"once": "^1.3.1", | ||
"unzip-response": "^1.0.0" | ||
}, | ||
@@ -20,3 +21,3 @@ "devDependencies": { | ||
"self-signed-https": "^1.0.5", | ||
"standard": "^3.3.0", | ||
"standard": "^4.5.2", | ||
"string-to-stream": "^1.0.0", | ||
@@ -23,0 +24,0 @@ "tape": "^4.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
15519
2
363
+ Addedunzip-response@^1.0.0
+ Addedunzip-response@1.0.2(transitive)