How to use caw - 1 common examples

To help you get started, we’ve selected a few caw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marionebl / omni-fetch / src / index.js View on Github external
function createProxyAgent(url) {
	// Determine environemt variable names to search for
	const {protocol} = parse(url);
	const protocolName = protocol.replace(':', '');
	const envNames = [
		`${protocolName}_proxy`,
		`${protocolName}_proxy`.toUpperCase()
	];

	// Check if proxy is configured for current url protocol
	const enabled = envNames.find(envName => process.env[envName]);

	// Return suitable proxy agent, null of none configured
	return enabled ? caw({protocol: protocolName}) : null;
}

caw

Construct HTTP/HTTPS agents for tunneling proxies

MIT
Latest version published 7 years ago

Package Health Score

62 / 100
Full package analysis

Popular caw functions