Skip to content

Commit

Permalink
don't use EnvHttpProxyAgent by default
Browse files Browse the repository at this point in the history
  • Loading branch information
10xLaCroixDrinker committed Apr 2, 2024
1 parent 3b7cd3b commit f31d3f9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions index-fetch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
'use strict'

const Dispatcher = require('./lib/dispatcher/dispatcher')
const api = require('./lib/api')
Object.assign(Dispatcher.prototype, api)

const fetchImpl = require('./lib/web/fetch').fetch

module.exports.fetch = function fetch (resource, init = undefined) {
Expand Down
4 changes: 2 additions & 2 deletions lib/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
// this version number must be increased to avoid conflicts.
const globalDispatcher = Symbol.for('undici.globalDispatcher.1')
const { InvalidArgumentError } = require('./core/errors')
const EnvHttpProxyAgent = require('./dispatcher/env-http-proxy-agent')
const Agent = require('./dispatcher/agent')

if (getGlobalDispatcher() === undefined) {
setGlobalDispatcher(new EnvHttpProxyAgent())
setGlobalDispatcher(new Agent())
}

function setGlobalDispatcher (agent) {
Expand Down
4 changes: 2 additions & 2 deletions test/node-fetch/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
FormData,
Response,
setGlobalDispatcher,
EnvHttpProxyAgent
Agent
} = require('../../index.js')
const HeadersOrig = require('../../lib/web/fetch/headers.js').Headers
const ResponseOrig = require('../../lib/web/fetch/response.js').Response
Expand All @@ -34,7 +34,7 @@ describe('node-fetch', () => {

before(async () => {
await local.start()
setGlobalDispatcher(new EnvHttpProxyAgent({
setGlobalDispatcher(new Agent({
connect: {
rejectUnauthorized: false
}
Expand Down
2 changes: 1 addition & 1 deletion test/node-test/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test('debug#fetch', async t => {
process.execPath,
[join(__dirname, '../fixtures/fetch.js')],
{
env: Object.assign({}, process.env, { NODE_DEBUG: 'fetch', NO_PROXY: '*' })
env: Object.assign({}, process.env, { NODE_DEBUG: 'fetch' })
}
)
const chunks = []
Expand Down

0 comments on commit f31d3f9

Please sign in to comment.