simple-get
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -21,2 +21,3 @@ module.exports = simpleGet | ||
if (body && !opts.method) opts.method = 'POST' | ||
if (opts.method) opts.method = opts.method.toUpperCase() | ||
@@ -48,3 +49,4 @@ if (opts.json) opts.headers.accept = 'application/json' | ||
cb(null, typeof unzipResponse === 'function' ? unzipResponse(res) : res) | ||
var tryUnzip = typeof unzipResponse === 'function' && opts.method !== 'HEAD' | ||
cb(null, tryUnzip ? unzipResponse(res) : res) | ||
}) | ||
@@ -51,0 +53,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": "2.2.1", | ||
"version": "2.2.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Feross Aboukhadijeh", |
@@ -484,1 +484,28 @@ var concat = require('concat-stream') | ||
}) | ||
test('HEAD request', function (t) { | ||
t.plan(3) | ||
var server = http.createServer(function (req, res) { | ||
t.equal(req.method, 'HEAD') | ||
// Taken from real-world response from HEAD request to GitHub.com | ||
res.setHeader('content-type', 'text/html; charset=utf-8') | ||
res.setHeader('content-encoding', 'gzip') | ||
res.setHeader('connection', 'close') | ||
res.statusCode = 200 | ||
req.pipe(res) | ||
}) | ||
server.listen(0, function () { | ||
var port = server.address().port | ||
var opts = { | ||
method: 'HEAD', | ||
url: 'http://localhost:' + port | ||
} | ||
get.head(opts, function (err, res) { | ||
t.error(err) | ||
t.equal(res.statusCode, 200) | ||
server.close() | ||
}) | ||
}) | ||
}) |
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
20538
524