0.1.0 • Published 9 years ago

superagent-jsonpx v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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