superagent-defaults
Create some defaults for superagent requests
Usage
var defaults = require('superagent-defaults');
var superagent = defaults();
superagent
.set('my-default-header', 'my-default-value')
.auth('myUsername', 'myPassword')
.on(function (req){
console.log(req.url);
});
superagent
.get('/my-api')
.end(function(res) {
console.log(res.text);
});
You may also pass a function that implements the superagent interface.
var defaults = require('superagent-defaults');
var supertest = require('supertest');
var request = defaults(supertest(app));
request
.get('/my-test-path')
.end(function(err, res) {
console.log(res.text);
});
Tests
$ npm test