@eccenca/superagent
Extended version of superagent.js, pimped with RX, better Link header parsing and HTTP Problem support
Last updated 2 years ago by kvollers .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @eccenca/superagent 
SYNC missed versions from official npm registry.

Eccenca extended Superagent lib (ecc-superagent)

Extended version of Superagent.js to use within eLDS framework

Usage

Includes Superagent.js and Superagent-rx packages. So, all you need to use it is import and call with your ajax requests:

import request from 'ecc-superagent';
// ...
// parse results
request
    .get(requestUrl)
    .observe() // this returns Rx.Observable
    .subscribe(function(res) {
        // use res
    });
// use results ...

Futhermore it is possible to register/unregister global superagent plugins to manipulate each request. For Example:

import request from 'ecc-superagent';

// Register a plugin which sets a header on each request
request.useForEachRequest('setHeaderPlugin', (request) => {
    request.set('X-Example-Header', 'FOO');
    return request;
});

// The following request will have the X-Example-Header set
request
    .get('http://example.org')
    .observe() // this returns Rx.Observable
    .subscribe(function(res) {
        // use res
    });

// Disable the plugin
request.useForEachRequest('setHeaderPlugin', false);

Current Tags

  • 1.4.1                                ...           latest (2 years ago)

8 Versions

  • 1.4.1                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.1-beta.2                                ...           2 years ago
  • 2.0.1-beta.1                                ...           2 years ago
  • 2.0.1-alpha.1                                ...           2 years ago
  • 2.0.0-alpha.1                                ...           2 years ago
  • 2.0.0                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
Downloads
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 0
Dependencies (4)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |