Skip to content
This repository
Browse code

Moving basic example to the top.

  • Loading branch information...
commit d67a041783df8d724662d82f9fb792db1be3f4f0 1 parent d1deb5b
Mikeal Rogers authored

Showing 1 changed file with 9 additions and 8 deletions. Show diff stats Hide diff stats

  1. 17  README.md
17  README.md
Source Rendered
@@ -18,6 +18,15 @@ Or from source:
18 18
 
19 19
 Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default.
20 20
 
  21
+<pre>
  22
+  var request = require('request');
  23
+  request({uri:'http://www.google.com'}, function (error, response, body) {
  24
+    if (!error && response.statusCode == 200) {
  25
+      sys.puts(body) // Print the google web page.
  26
+    }
  27
+  })
  28
+</pre>
  29
+
21 30
 #### request(options, callback)
22 31
 
23 32
 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
38 47
 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.
39 48
 
40 49
 Examples:
41  
-<pre>
42  
-  var request = require('request');
43  
-  request({uri:'http://www.google.com'}, function (error, response, body) {
44  
-    if (!error && response.statusCode == 200) {
45  
-      sys.puts(body) // Print the google web page.
46  
-    }
47  
-  })
48  
-</pre>
49 50
 
50 51
 <pre>
51 52
   var request = require('request');

0 notes on commit d67a041

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