updated docs for http.request

This commit is contained in:
walterhiggins 2015-02-16 22:11:41 +00:00
parent fec318c2a4
commit ed117e19c2

View file

@ -4765,24 +4765,26 @@ main thread of execution.
The following example illustrates how to use http.request to make a request to a JSON web service and evaluate its response... The following example illustrates how to use http.request to make a request to a JSON web service and evaluate its response...
var jsResponse; ```javascript
var http = require('./http/request'); var jsResponse;
http.request("http://scriptcraftjs.org/sample.json",function(responseCode, responseBody){ var http = require('request');
jsResponse = eval("(" + responseBody + ")"); http.request('http://scriptcraftjs.org/sample.json',function(responseCode, responseBody){
}); jsResponse = JSON.parse( responseBody );
});
```
The following example illustrates a more complex use-case POSTing parameters to a CGI process on a server...
... The following example illustrates a more complex use-case POSTing parameters to a CGI process on a server... ```javascript
var http = require('http');
var http = require('./http/request'); http.request( {
http.request( url: 'http://pixenate.com/pixenate/pxn8.pl',
{ method: 'POST',
url: 'http://pixenate.com/pixenate/pxn8.pl', params: {script: '[]'}
method: 'POST', },
params: {script: '[]'} function( responseCode, responseBody ) {
}, var jsObj = JSON.parse( responseBody );
function( responseCode, responseBody ) { });
var jsObj = eval('(' + responseBody + ')'); ```
});
## sc-mqtt module ## sc-mqtt module