simple-get
Advanced tools
Comparing version 2.2.3 to 2.2.4
@@ -25,3 +25,3 @@ module.exports = simpleGet | ||
if (opts.json && body) opts.headers['content-type'] = 'application/json' | ||
if (body) opts.headers['Content-Length'] = body.length | ||
if (body) opts.headers['Content-Length'] = Buffer.byteLength(body) | ||
@@ -28,0 +28,0 @@ // Request gzip/deflate |
{ | ||
"name": "simple-get", | ||
"description": "Simplest way to make http get requests. Supports HTTPS, redirects, gzip/deflate, streams in < 100 lines.", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Feross Aboukhadijeh", |
@@ -320,2 +320,28 @@ var concat = require('concat-stream') | ||
test('post (utf-8 text body)', function (t) { | ||
t.plan(4) | ||
var server = http.createServer(function (req, res) { | ||
t.equal(req.method, 'POST') | ||
res.statusCode = 200 | ||
req.pipe(res) | ||
}) | ||
server.listen(0, function () { | ||
var port = server.address().port | ||
var opts = { | ||
url: 'http://localhost:' + port, | ||
body: 'jedan dva tri četiri' | ||
} | ||
get.post(opts, function (err, res) { | ||
t.error(err) | ||
t.equal(res.statusCode, 200) | ||
res.pipe(concat(function (data) { | ||
t.equal(data.toString(), 'jedan dva tri četiri') | ||
server.close() | ||
})) | ||
}) | ||
}) | ||
}) | ||
test('post (buffer body)', function (t) { | ||
@@ -322,0 +348,0 @@ t.plan(4) |
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
21207
548