superagent-request-modifier

0.11.1 • Public • Published

superagent-request-modifier

Patch superagent to add headers or queries to each request on a given host.

Use this to e.g. send access tokens with mobile api requests

Usage:
import request from 'superagent'
import configureModifier from 'superagent-request-modifier'
 
// All requests to localhost will have {access_token: 'asdf1234'} added as a header
configureModifier(request, {hostname: 'localhost', headers: {access_token: 'asdf1234'}})
 
// All requests to example.com will have ?access_token="asdf1234" added to the url as a query string
configureModifier(request, {hostname: 'example.com', query: {access_token: 'asdf1234'}})

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.11.10latest

Version History

VersionDownloads (Last 7 Days)Published
0.11.10
0.11.00
0.10.20
0.10.10
0.10.00
0.2.20
0.2.10
0.2.00
0.1.10
0.1.00

Package Sidebar

Install

npm i superagent-request-modifier

Weekly Downloads

0

Version

0.11.1

License

MIT

Last publish

Collaborators

  • founderlab