mirror of
https://github.com/nodejs/node.git
synced 2025-12-27 23:41:14 +00:00
This adds an API to dynamically enable built-in proxy support for all of fetch() and http.request()/https.request(), so that users do not have to be aware of them all and configure them one by one. PR-URL: https://github.com/nodejs/node/pull/60953 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
22 lines
566 B
JavaScript
22 lines
566 B
JavaScript
// Tests that http.setGlobalProxyFromEnv() is a no-op when no proxy is configured.
|
|
|
|
import '../common/index.mjs';
|
|
import assert from 'node:assert';
|
|
import { startTestServers, checkProxiedFetch } from '../common/proxy-server.js';
|
|
|
|
const { proxyLogs, shutdown, httpEndpoint: { requestUrl } } = await startTestServers({
|
|
httpEndpoint: true,
|
|
});
|
|
|
|
await checkProxiedFetch({
|
|
FETCH_URL: requestUrl,
|
|
SET_GLOBAL_PROXY: JSON.stringify({}),
|
|
}, {
|
|
stdout: 'Hello world',
|
|
});
|
|
|
|
shutdown();
|
|
|
|
// Verify request did NOT go through proxy.
|
|
assert.deepStrictEqual(proxyLogs, []);
|