Skip to content

Commit

Permalink
docs(readme): use ProxyAgent in example (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
itpropro authored Jan 8, 2025
1 parent bdfb507 commit cd01c2f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/");
```
Expand Down

0 comments on commit cd01c2f

Please sign in to comment.