sp
superagent-promise
npm i superagent-promise
sp

superagent-promise

Simple/dumb promise wrapper for superagent

by James Lal

1.1.0 (see all)License:MITTypeScript:Not Found
npm i superagent-promise
Readme

Build Status

superagent-promise

Simple/dumb promise wrapper for superagent. You must depend on superagent and your favorite Promise library directly.

Usage

var Promise = this.Promise || require('promise');
var agent = require('superagent-promise')(require('superagent'), Promise);

// method, url form with `end`
agent('GET', 'http://google.com')
  .end()
  .then(function onResult(res) {
    // do stuff
  }, function onError(err) {
    //err.response has the response from the server
  });

// method, url form with `then`
agent('GET', 'http://google.com')
  .then(function onResult(res) {
    // do stuff
  });


// helper functions: options, head, get, post, put, patch, del
agent.put('http://myxfoo', 'data')
  .end()
  .then(function(res) {
    // do stuff`
  });

// helper functions: options, head, get, post, put, patch, del
agent.put('http://myxfoo', 'data').
  .then(function(res) {
    // do stuff
  });


Downloads/wk

13.9K

GitHub Stars

129

LAST COMMIT

5yrs ago

MAINTAINERS

4

CONTRIBUTORS

4

OPEN ISSUES

5

OPEN PRs

2
VersionTagPublished
1.1.0
latest
7yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate