#1195 | 2023-03-09 17:16:15

nodejs v18 增加了 fetch 这个全局对象,实现了 https://developer.mozilla.org/en-US/docs/Web/API/fetch 的 API

在这个 PR 里,还支持了使用代理:

import { ProxyAgent } from 'undici'

const proxyAgent = new ProxyAgent('http://127.0.0.1:49655')

const res = await fetch('https://ipip.viegg.com', {
  dispatcher: proxyAgent
})
console.log(await res.json())