You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
503 B
19 lines
503 B
//Shows thunked methods in acion (se moore at https://github.com/mikeal/request/blob/master/README.md)
|
|
|
|
var co = require('co')
|
|
, request = require('../');
|
|
|
|
co(function* () {
|
|
//Get method
|
|
var getResponse = yield request.get('http://nodejs.org');
|
|
var body = getResponse.body;
|
|
|
|
console.log('Get Response: ', getResponse);
|
|
console.log('Get Body: ', body);
|
|
|
|
//Post method
|
|
var postResponse = yield request.post('http://nodejs.org');
|
|
|
|
console.log('Post Response: ', postResponse);
|
|
|
|
})();
|
|
|