Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index-fetch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const EnvHttpProxyAgent = require('./lib/dispatcher/env-http-proxy-agent')
const fetchImpl = require('./lib/web/fetch').fetch

module.exports.fetch = function fetch (resource, init = undefined) {
Expand All @@ -19,3 +20,6 @@ module.exports.WebSocket = require('./lib/web/websocket/websocket').WebSocket
module.exports.MessageEvent = require('./lib/web/websocket/events').MessageEvent

module.exports.EventSource = require('./lib/web/eventsource/eventsource').EventSource

// Expose the fetch implementation to be enabled in Node.js core via a flag
module.exports.EnvHttpProxyAgent = EnvHttpProxyAgent
9 changes: 9 additions & 0 deletions test/fetch/export-env-proxy-agent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict'

const { test } = require('node:test')
const assert = require('node:assert')
const undiciFetch = require('../../undici-fetch')

test('EnvHttpProxyAgent should be part of Node.js bundle', () => {
assert.strictEqual(typeof undiciFetch.EnvHttpProxyAgent, 'function')
})