thunkagent

Yieldable SuperAgent with a thunk() method

Usage no npm install needed!

<script type="module">
  import thunkagent from 'https://cdn.skypack.dev/thunkagent';
</script>

README

thunkagent

Build Status

Yieldable SuperAgent with a thunk() method.

This module is a workaround for SuperAgent's issue #230.

Installation

$ npm install thunkagent --save

Example

var request = require('thunkagent');
var co = require('co');

co(function *(){
    var ua = 'Mozilla/1.0';
    var response = yield request
        .post('http://httpbin.org/post')
        .send({lorem: 'ipsum'})
        .set('User-Agent', ua)
        .thunk();

    console.log(response.body);
})();