superagent-promise
superagent promise wrapper
Last updated 5 years ago by clayreimann .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install superagent-promise 
SYNC missed versions from official npm registry.

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
  });


Current Tags

  • 1.1.0                                ...           latest (5 years ago)

8 Versions

  • 1.1.0                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
  • 0.0.0                                ...           6 years ago
Downloads
Today 0
This Week 22
This Month 14
Last Day 11
Last Week 19
Last Month 156
Dependencies (0)
None
Dev Dependencies (8)
Dependents (189)

Copyright 2014 - 2016 © taobao.org |