You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ the passed options and sends the request using [fetch](https://developer.mozilla
29
29
-[Special cases](#special-cases)
30
30
-[The `data` parameter – set request body directly](#the-data-parameter--set-request-body-directly)
31
31
-[Set parameters for both the URL/query and the request body](#set-parameters-for-both-the-urlquery-and-the-request-body)
32
+
-[Set a custom Agent to your requests](#set-a-custom-agent-to-your-requests)
32
33
-[LICENSE](#license)
33
34
34
35
<!-- tocstop -->
@@ -528,6 +529,40 @@ request(
528
529
);
529
530
```
530
531
532
+
### Set a custom Agent to your requests
533
+
534
+
The way to pass a custom `Agent` to requests is by creating a custom `fetch` function and pass it as `options.request.fetch`. A good example can be [undici's `fetch` implementation](https://undici.nodejs.org/#/?id=undicifetchinput-init-promise).
535
+
536
+
Example ([See example in CodeSandbox](https://codesandbox.io/p/sandbox/nifty-stitch-wdlwlf))
0 commit comments