Skip to content

wheresrhys/superagent-promises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

superagent-promises

Wraps superagent requests in ES6 promises (see the es6 promises polyfill and mdn for W3C Promise API documentation).

Usage

e.g

require('superagent')
  .get('http://api.mysite.com/?id=23432')
  .use(require('superagent-promises'))
  .end()
  .then(function (response) {
    // handle a successful response
  }, function (err) {
    // handle an error
  })

Note on testing

superagent-promises caches the native .end() method of superagent. For testing purposes an .uncache() method is provided, which should be called immediately before spying or stubbing superagent.end()

About

Wraps superagent requests in ES6 promises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published