co-request thunkify wrapper for request

npm install co-request
16 downloads in the last day
97 downloads in the last week
252 downloads in the last month


Simple wrapper to the request library for co-like interface (node.js generator based code). You can use it with koa or co

To install simply run:

npm install co-request

Require co first, also it will work on node v0.11.7 and newest only.

You must run node with --harmony flag (--harmony-generators as well)

node --harmony simple.js

Simple example:

var co = require('co')
  , request = require('co-request');

co(function* () {
  // You can also pass options object, see docs
  var result = yield request(''); 
  var response = result;
  var body = result.body;

  console.log('Response: ', response);
  console.log('Body: ', body);

POST example:

co(function* () {
  var result = yield request({
      uri: '',
      method: 'POST'

All methods of request listed in Request docs


Thanks for Tj's Co library

Thanks for Mikeal's Request library

npm loves you