Permalink
Browse files

Matching node documentation style.

  • Loading branch information...
1 parent 104cc94 commit 12a4cb88b949cb4a81d51189d432c25c08522a87 @mikeal mikeal committed May 7, 2010
Showing with 15 additions and 18 deletions.
  1. +15 −18 README.md
View
@@ -1,34 +1,31 @@
# 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) {
if (!error && response.statusCode == 200) {
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.