Skip to content

Commit

Permalink
Matching node documentation style.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeal committed May 7, 2010
1 parent 104cc94 commit 12a4cb8
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.