Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Matching node documentation style.

  • Loading branch information...
commit 12a4cb88b949cb4a81d51189d432c25c08522a87 1 parent 104cc94
@mikeal mikeal authored
Showing with 15 additions and 18 deletions.
  1. +15 −18 README.md
View
33 README.md
@@ -1,15 +1,26 @@
# Request -- Simplified HTTP request method
-### Install
+## Install
<pre>
npm install request
</pre>
-### Super simple to use
+## Super simple to use
-request(options, callback);
+#### request(options, callback)
+The first argument is an options object. The only required option is uri, all others are optional.
+
+* `'uri'` - fully qualified uri or a parsed url object from url.parse()
+* `'method'` - http method, defaults to GET
+* `'headers'` - http headers, defaults to {}
+* `'body'` - entity body for POST and PUT requests
+* `'client'` - existing http client object (when undefined a new one will be created and assigned to this property so you can keep around a reference to it if you would like use keep-alive on later request)
+
+The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body buffer.
+
+Example:
<pre>
var request = require('request');
request({uri:'http://www.google.com'}, function (error, response, body) {
@@ -17,18 +28,4 @@ request(options, callback);
sys.puts(body) // Print the google web page.
}
})
-</pre>
-
-### Options
-
-The first argument is an options object. The only required option is uri, all others are optional.
-
-uri : fully qualified uri or a parsed url object from url.parse()
-method : http method, defaults to GET
-headers : http headers, defaults to {}
-body : entity body for POST and PUT requests
-client : existing http client object (when undefined a new one will be created and assigned to this property so you can keep around a reference to it if you would like use keep-alive on later request)
-
-### callback
-
-The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body buffer.
+</pre>

0 comments on commit 12a4cb8

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