diff --git a/README.md b/README.md index 720a8145..af73de87 100644 --- a/README.md +++ b/README.md @@ -346,12 +346,12 @@ const data = await ofetch("https://icanhazip.com"); **Example:** Allow self-signed certificates (USE AT YOUR OWN RISK!) ```ts -import { Agent } from "undici"; +import { ProxyAgent } from "undici"; import { ofetch } from "ofetch"; // Note: This makes fetch unsecure against MITM attacks. USE AT YOUW OWN RISK! -const unsecureAgent = new Agent({ connect: { rejectUnauthorized: false } }); -const unsecureFetch = ofetch.create({ dispatcher: unsecureAgent }); +const unsecureProxyAgent = new ProxyAgent({ requestTls: { rejectUnauthorized: false } }); +const unsecureFetch = ofetch.create({ dispatcher: unsecureProxyAgent }); const data = await unsecureFetch("https://www.squid-cache.org/"); ```