Skip to content

Commit cd01c2f

Browse files
authored
docs(readme): use ProxyAgent in example (#465)
1 parent bdfb507 commit cd01c2f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,12 @@ const data = await ofetch("https://icanhazip.com");
346346
**Example:** Allow self-signed certificates (USE AT YOUR OWN RISK!)
347347

348348
```ts
349-
import { Agent } from "undici";
349+
import { ProxyAgent } from "undici";
350350
import { ofetch } from "ofetch";
351351

352352
// Note: This makes fetch unsecure against MITM attacks. USE AT YOUW OWN RISK!
353-
const unsecureAgent = new Agent({ connect: { rejectUnauthorized: false } });
354-
const unsecureFetch = ofetch.create({ dispatcher: unsecureAgent });
353+
const unsecureProxyAgent = new ProxyAgent({ requestTls: { rejectUnauthorized: false } });
354+
const unsecureFetch = ofetch.create({ dispatcher: unsecureProxyAgent });
355355

356356
const data = await unsecureFetch("https://www.squid-cache.org/");
357357
```

0 commit comments

Comments
 (0)