superagent-defaults

Create some defaults for superagent requests

npm install superagent-defaults
63 downloads in the last day
344 downloads in the last week
1 383 downloads in the last month

superagent-defaults Build Status

Create some defaults for superagent requests

Usage

var defaults = require('superagent-defaults');

// Create a defaults context
var superagent = defaults();

// Setup some defaults
superagent
  .set('my-default-header', 'my-default-value')
  .auth('myUsername', 'myPassword')
  .on(function (req){
    console.log(req.url);
  });

// Use superagent like you always have; the defaults will be applied to
// each request automatically
superagent
  .get('/my-api')
  .end(function(res) {
    console.log(res.text);
  });

Tests

$ npm test
npm loves you