Socket
Socket
Sign inDemoInstall

superagent-defaults

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superagent-defaults

Create some defaults for superagent requests


Version published
Weekly downloads
16K
decreased by-1.8%
Maintainers
2
Weekly downloads
 
Created
Source

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('request', 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);
  });

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

Keywords

FAQs

Package last updated on 02 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc