-
Notifications
You must be signed in to change notification settings - Fork 151
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationnode
Description
Update
it seems like a bug of node
Environment
ofetch: v1.0.1
node:v18.14.2
Reproduction
here is a minimum recurrence demo
import { getProxySettings } from "get-proxy-settings";
import { ofetch } from "ofetch/node";
import httpAgent from 'http-proxy-agent'
import httpsAgent from 'https-proxy-agent'
let agent
await (async function setSystemProxy() {
const { http, https } = (await getProxySettings()) || {}
function agentGenerator(ProxySetting) {
const { protocol, host, port } = ProxySetting
const agentUrl = `${protocol}://${host}:${port}`
if (protocol === 'http') {
return new httpAgent(agentUrl)
}
if (protocol === 'https') {
return new httpsAgent(agentUrl)
}
return false
}
if (http) {
agent = agentGenerator(http)
}
if (https) {
agent = agentGenerator(https)
}
})().then(async () => {
const response = await ofetch.raw('https://google.com', { agent })
})Describe the bug
Nodejs has supported fetch api since v17.5.0
This caused current issue:
export const fetch = globalThis.fetch || createNodeFetch();I'm going to submit a PR to fix this bug!
Additional context
No response
Logs
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationnode