Vit*_*ali 6 javascript fetch node.js undici
如何使用自签名证书(来自 undici)fetch('https://localhost:8888')本地运行的 HTTP 服务器?fetch
诀窍是使用setGlobalDispatcher(getGlobalDispatcher可以用来抓取原始的以便以后恢复)。
import {\n fetch,\n setGlobalDispatcher,\n Agent,\n} from 'undici'\n\nsetGlobalDispatcher(new Agent({\n\xc2\xa0 connect: {\n\xc2\xa0 \xc2\xa0 rejectUnauthorized: false\n\xc2\xa0 }\n}))\n\nfetch('https://localhost:8888').then(...)\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
1952 次 |
| 最近记录: |