mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +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
441 B
JavaScript
22 lines
441 B
JavaScript
// Tests that http.setGlobalProxyFromEnv() throws on invalid HTTP proxy URL.
|
|
|
|
import '../common/index.mjs';
|
|
import assert from 'node:assert';
|
|
import http from 'node:http';
|
|
|
|
assert.throws(() => {
|
|
http.setGlobalProxyFromEnv({
|
|
http_proxy: 'not a url',
|
|
});
|
|
}, {
|
|
code: 'ERR_PROXY_INVALID_CONFIG',
|
|
});
|
|
|
|
assert.throws(() => {
|
|
http.setGlobalProxyFromEnv({
|
|
https_proxy: 'not a url',
|
|
});
|
|
}, {
|
|
code: 'ERR_PROXY_INVALID_CONFIG',
|
|
});
|