conditional-agent

1.0.1 • Public • Published

How about wrapping up an http(s) , maybe proxy? , agent and checking wrt request whether to call the agent or not? Sounds good? This module doex exactly that!

Ex:

	const ConditionalAgent = require('conditional-agent')
	const agent = new http.Agent(/* whatever ..... */);
	const newAgent = new ConditionalAgent(function cb(req, options) { /* Can be async */
	    return req.method === 'GET';
	}, agent);


	// Now use newAgent or override global as https.globalAgent = newAgent;

Readme

Keywords

Package Sidebar

Install

npm i conditional-agent

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

2.87 kB

Total Files

4

Last publish

Collaborators

  • prkeshri