Skip to content
Browse files

updated readme, examples, version; added contributors

  • Loading branch information...
1 parent f4c0430 commit e1fc8b07459ac44fb6777731f95de961d2f81264 @SamDecrock committed Mar 26, 2013
Showing with 19 additions and 7 deletions.
  1. +6 −0 README.md
  2. +6 −6 examples.js
  3. +7 −1 package.json
View
6 README.md
@@ -33,6 +33,8 @@ __Arguments__
- binary: true/false (default: false), if true, res.body will a buffer containing the binary data
- body: custom body content you want to send
- allowRedirects: (default: __true__ ...only with httpreq.get ), if true, redirects will be followed
+ - maxRedirects: (default: 10). For example 1 redirect will allow for one normal request and 1 extra redirected request.
+ - timeout: (default: none). Adds a timeout to the http(s) request. Should be in milliseconds.
- 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__ )
__Example without options__
@@ -88,6 +90,8 @@ __Arguments__
- 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 is used.
- allowRedirects: (default: false), if true, redirects will be followed
+ - maxRedirects: (default: 10). For example 1 redirect will allow for one normal request and 1 extra redirected request.
+ - timeout: (default: none). Adds a timeout to the http(s) request. Should be in milliseconds.
- 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__ )
__Example without extra options__
@@ -184,6 +188,8 @@ __Arguments__
- binary: true/false (default: false), if true, res.body will a buffer containing the binary data
- body: custom body content you want to send
- allowRedirects: (default: false), if true, redirects will be followed
+ - maxRedirects: (default: 10). For example 1 redirect will allow for one normal request and 1 extra redirected request.
+ - timeout: (default: none). Adds a timeout to the http(s) request. Should be in milliseconds.
- 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__ )
__Example__
View
12 examples.js
@@ -115,11 +115,11 @@ httpreq.post('http://posttestserver.com/post.php',{
}
);
-
// set max redirects:
httpreq.get('http://scobleizer.com/feed/',{
+ maxRedirects: 2, // default is 10
headers:{
- 'User-Agent': 'Magnet', //for some reason causes endless redirects on this site...
+ 'User-Agent': 'Magnet', //for some reason causes endless redirects on this site...
}},
function (err, res) {
if (err){
@@ -130,9 +130,10 @@ httpreq.get('http://scobleizer.com/feed/',{
}
);
-
-// set timeout
-httpreq.get('http://www.androidpatterns.com/feed', {timeout: (5 * 1000)},
+// set timeout
+httpreq.get('http://localhost:3000/',{
+ timeout: (5 * 1000) // timeout in milliseconds
+ },
function (err, res) {
if (err){
console.log(err);
@@ -143,4 +144,3 @@ httpreq.get('http://www.androidpatterns.com/feed', {timeout: (5 * 1000)},
);
-
View
8 package.json
@@ -1,7 +1,7 @@
{
"name": "httpreq",
"description": "node-httpreq is a node.js library to do HTTP(S) requests the easy way",
- "version": "0.2.7",
+ "version": "0.2.8",
"author": {
"name": "Sam Decrock",
"url": "https://github.com/SamDecrock/"
@@ -15,6 +15,12 @@
"url": "git://github.com/SamDecrock/node-httpreq.git"
},
"main": "./httpreq",
+ "contributors": [
+ {
+ "name": "Russell Beattie",
+ "url": "https://github.com/russellbeattie"
+ }
+ ],
"licenses": [
{
"type": "MIT",

0 comments on commit e1fc8b0

Please sign in to comment.
Something went wrong with that request. Please try again.