httpreq
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -106,2 +106,4 @@ /* | ||
function requestResponse(res){ | ||
var ended = false; | ||
res.on('data', function (chunk) { | ||
@@ -112,2 +114,3 @@ chunks.push(chunk); | ||
res.on('end', function (err) { | ||
ended = true; | ||
var responsebody = Buffer.concat(chunks); | ||
@@ -120,4 +123,5 @@ if(!o.binary) | ||
res.on('close', function (err) { | ||
callback(err); | ||
res.on('close', function () { | ||
if(!ended) | ||
callback(new Error("Request aborted")); | ||
}); | ||
@@ -210,2 +214,4 @@ } | ||
function requestResponse(res){ | ||
var ended = false; | ||
res.on('data', function (chunk) { | ||
@@ -216,2 +222,3 @@ chunks.push(chunk); | ||
res.on('end', function (err) { | ||
ended = true; | ||
var responsebody = Buffer.concat(chunks); | ||
@@ -224,4 +231,5 @@ if(!o.binary) | ||
res.on('close', function (err) { | ||
callback(err); | ||
res.on('close', function () { | ||
(!ended) | ||
callback(new Error("Request aborted")); | ||
}); | ||
@@ -228,0 +236,0 @@ } |
{ | ||
"name": "httpreq", | ||
"description": "node-httpreq is a node.js library to do HTTP(S) requests the easy way", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Sam Decrock", |
@@ -88,3 +88,3 @@ node-httpreq | ||
- binary: true/false (default: false), if true, res.body will a buffer containing the binary data | ||
- body: custom body content you want to send. Parameters are ignored when this used. | ||
- body: custom body content you want to send. Parameters are ignored when this is used. | ||
- callback(err, res): A callback function which is called when the request is complete. __res__ contains the headers ( __res.headers__ ) and the body ( __res.body__ ) | ||
@@ -91,0 +91,0 @@ |
76290
295