superagent-promise-headers

SuperAgent Bluebird promises - header extension

Usage no npm install needed!

<script type="module">
  import superagentPromiseHeaders from 'https://cdn.skypack.dev/superagent-promise-headers';
</script>

README

superagent-promise-headers

SuperAgent Bluebird promises - header extension

Node Version 6.9.x

What

- Adding headers to HTTP request.
- Converting superagent to `Bluebird` promise.

How


var request = require('superagent-promise-headers')({
    headers: {
        base: { 'content-service': 'Doron-Service' },
        get: { 'content-service-type': 'Doron-Service-GET' },
        post: { 'content-service': 'Doron-Service-POST' },
        del: { 'content-service': 'Doron-Service-DELETE' },
        put: { 'content-service': 'Doron-Service-PUT' }
    }
});

request
.get('http://google.com')
.then(function(res){
    // Success
    console.log(res);
}).catch(function(e){
    //Failure
    console.log(e.res);
});

issues?

Just checkout the github issue page Github