Skip to content
This repository
Browse code

Matching node documentation style.

  • Loading branch information...
commit 12a4cb88b949cb4a81d51189d432c25c08522a87 1 parent 104cc94
Mikeal Rogers authored

Showing 1 changed file with 15 additions and 18 deletions. Show diff stats Hide diff stats

  1. +15 18 README.md
33 README.md
Source Rendered
... ... @@ -1,15 +1,26 @@
1 1 # Request -- Simplified HTTP request method
2 2
3   -### Install
  3 +## Install
4 4
5 5 <pre>
6 6 npm install request
7 7 </pre>
8 8
9   -### Super simple to use
  9 +## Super simple to use
10 10
11   -request(options, callback);
  11 +#### request(options, callback)
12 12
  13 +The first argument is an options object. The only required option is uri, all others are optional.
  14 +
  15 +* `'uri'` - fully qualified uri or a parsed url object from url.parse()
  16 +* `'method'` - http method, defaults to GET
  17 +* `'headers'` - http headers, defaults to {}
  18 +* `'body'` - entity body for POST and PUT requests
  19 +* `'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)
  20 +
  21 +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.
  22 +
  23 +Example:
13 24 <pre>
14 25 var request = require('request');
15 26 request({uri:'http://www.google.com'}, function (error, response, body) {
@@ -17,18 +28,4 @@ request(options, callback);
17 28 sys.puts(body) // Print the google web page.
18 29 }
19 30 })
20   -</pre>
21   -
22   -### Options
23   -
24   -The first argument is an options object. The only required option is uri, all others are optional.
25   -
26   -uri : fully qualified uri or a parsed url object from url.parse()
27   -method : http method, defaults to GET
28   -headers : http headers, defaults to {}
29   -body : entity body for POST and PUT requests
30   -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)
31   -
32   -### callback
33   -
34   -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.
  31 +</pre>

0 comments on commit 12a4cb8

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