Permalink
Browse files

Moving basic example to the top.

  • Loading branch information...
1 parent d1deb5b commit d67a041783df8d724662d82f9fb792db1be3f4f0 @mikeal mikeal committed Feb 11, 2011
Showing with 9 additions and 8 deletions.
  1. +9 −8 README.md
View
@@ -18,6 +18,15 @@ Or from source:
Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default.
+<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>
+
#### request(options, callback)
The first argument is an options object. The only required option is uri, all others are optional.
@@ -38,14 +47,6 @@ The first argument is an options object. The only required option is uri, all ot
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.
Examples:
-<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>
<pre>
var request = require('request');

0 comments on commit d67a041

Please sign in to comment.