node-fetch-with-proxy
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -9,2 +9,2 @@ 'use strict'; | ||
return fetch(url, { agent, ...options }); | ||
} | ||
}; |
{ | ||
"name": "node-fetch-with-proxy", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "node-fetch with proxy-agent", | ||
@@ -8,3 +8,4 @@ "main": "lib/fetch-with-proxy.js", | ||
"scripts": { | ||
"test": "node test/test.js" | ||
"test": "jest", | ||
"format": "prettier --write \"{lib,test}/**/*.js\"" | ||
}, | ||
@@ -15,3 +16,7 @@ "repository": { | ||
}, | ||
"keywords": [], | ||
"keywords": [ | ||
"http", | ||
"fetch", | ||
"proxy" | ||
], | ||
"author": "Shinsuke Noguchi <shinsuke.noguchi@gmail.com>", | ||
@@ -26,3 +31,12 @@ "license": "MIT", | ||
"proxy-agent": "^3.1.1" | ||
}, | ||
"devDependencies": { | ||
"http-proxy": "^1.18.0", | ||
"jest": "^24.9.0", | ||
"prettier": "^1.19.1" | ||
}, | ||
"prettier": { | ||
"singleQuote": true, | ||
"printWidth": 120 | ||
} | ||
} |
# node-fetch-with-proxy | ||
Simple integration of [node-fetch](https://www.npmjs.com/package/node-fetch) and [proxy-agent](https://www.npmjs.com/package/proxy-agent) | ||
Thin wrapper of [node-fetch](https://www.npmjs.com/package/node-fetch) that can be used behind the proxy. | ||
The proxy specified by the environment variable (HTTP_PROXY, https_proxy, etc.) is used in Node.js environment. | ||
## Install | ||
```sh | ||
$ npm install node-fetch-with-proxy | ||
``` | ||
## Usage | ||
See [node-fetch](https://www.npmjs.com/package/node-fetch) | ||
## Advanced Usage | ||
You can explicitly specify proxy options with the 3rd argument of `fetch` API. | ||
```javascript | ||
const proxyUrl = 'http://your.proxy:port'; | ||
fetch('https://httpbin.org/post', { | ||
method: 'POST', | ||
body: 'foo=bar' | ||
}, proxyUrl); | ||
``` |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
5663
7
68
29
3
2
7