superagent-jsonpx

0.1.0 • Public • Published

superagent-jsonpx

npm version Coverage Status

Installation

Install for node.js or browserify using npm:

$ npm install --save-dev superagent-jsonpx

Example

var request = require('superagent');
var jsonp = require('superagent-jsonpx');
 
var options = { timeout: 3000, callbackKey: 'cb' };
 
request.get(uri)
  .use(jsonp(options))
  .end(function (err, res) {
    if (!err && res.body) {
      // request success
      console.log(res.body);
    } else {
      // request timeout (or error)
    }
  });

Options

timeout

If there is no response after a timeout, it will determine that an error has occurred.

  • default: 1000ms

callbackKey

This will change the default query string callback parameter.

  • default: callback

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i superagent-jsonpx

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • mnatsu31