Comparing version 0.2.4 to 0.2.5
@@ -38,3 +38,7 @@ /* | ||
moreOptions.method = 'GET'; | ||
this.doRequest(moreOptions, callback); | ||
if(moreOptions.allowRedirects === undefined) | ||
moreOptions.allowRedirects = true; | ||
doRequest(moreOptions, callback); | ||
} | ||
@@ -50,6 +54,6 @@ | ||
moreOptions.method = 'POST'; | ||
this.doRequest(moreOptions, callback); | ||
doRequest(moreOptions, callback); | ||
} | ||
exports.doRequest = function(o, callback){ | ||
function doRequest(o, callback){ | ||
var chunks = []; | ||
@@ -116,2 +120,9 @@ var body; | ||
ended = true; | ||
// check for redirects | ||
if(res.headers.location && o.allowRedirects){ | ||
o.url = res.headers.location; | ||
return doRequest(o, callback); | ||
} | ||
var responsebody = Buffer.concat(chunks); | ||
@@ -251,2 +262,2 @@ if(!o.binary) | ||
exports.doRequest = doRequest; |
{ | ||
"name": "httpreq", | ||
"description": "node-httpreq is a node.js library to do HTTP(S) requests the easy way", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Sam Decrock", |
@@ -35,2 +35,3 @@ node-httpreq | ||
- body: custom body content you want to send | ||
- allowRedirects: (default: __true__ ...only with httpreq.get ), if true, redirects will be followed | ||
- callback(err, res): A callback function which is called when the request is complete. __res__ contains the headers ( __res.headers__ ), the http status code ( __res.statusCode__ ) and the body ( __res.body__ ) | ||
@@ -90,2 +91,3 @@ | ||
- body: custom body content you want to send. Parameters are ignored when this is used. | ||
- allowRedirects: (default: false), if true, redirects will be followed | ||
- callback(err, res): A callback function which is called when the request is complete. __res__ contains the headers ( __res.headers__ ), the http status code ( __res.statusCode__ ) and the body ( __res.body__ ) | ||
@@ -186,2 +188,3 @@ | ||
- body: custom body content you want to send | ||
- allowRedirects: (default: false), if true, redirects will be followed | ||
- callback(err, res): A callback function which is called when the request is complete. __res__ contains the headers ( __res.headers__ ), the http status code ( __res.statusCode__ ) and the body ( __res.body__ ) | ||
@@ -188,0 +191,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
77040
303
258