| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -129,7 +129,7 @@ await fetch("https://google.com", { | |||
| 129 | 129 | ||
| 130 | 130 | `createProxy` returns an object with `agent` for older Node.js versions and `dispatcher` keys for newer Node.js versions with Undici and native fetch. | |
| 131 | 131 | ||
| 132 | - If no `url` option is provided, `HTTPS_PROXY` or `HTTP_PROXY` values will be used, and if they also are not set, both `agent` and `dispatcher` values will be undefined. | ||
| 132 | + If no `url` option is provided, `HTTPS_PROXY` or `HTTP_PROXY` (or lowercase) environment variables will be used, and if they also are not set, both `agent` and `dispatcher` values will be undefined. | ||
| 133 | 133 | ||
| 134 | 134 | > [!NOTE] | |
| 135 | 135 | > Using export conditions, this utility works in Node.js and for other runtimes, it will simply return a stubbed version as most of the other runtimes now support HTTP proxy out of the box! | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,12 @@ import { HttpProxyAgent } from "http-proxy-agent"; | |||
| 7 | 7 | import { HttpsProxyAgent } from "https-proxy-agent"; | |
| 8 | 8 | ||
| 9 | 9 | export function createProxy(opts: { url?: string } = {}) { | |
| 10 | - const uri = opts.url || process.env.HTTPS_PROXY || process.env.HTTP_PROXY; | ||
| 10 | + const uri = | ||
| 11 | + opts.url || | ||
| 12 | + process.env.HTTPS_PROXY || | ||
| 13 | + process.env.https_proxy || | ||
| 14 | + process.env.HTTP_PROXY || | ||
| 15 | + process.env.http_proxy; | ||
| 11 | 16 | ||
| 12 | 17 | if (!uri) { | |
| 13 | 18 | return { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments