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: deps/undici/src/README.md
+33-11
Original file line number
Diff line number
Diff line change
@@ -185,12 +185,12 @@ Help us improve the test coverage by following instructions at [nodejs/undici/#9
185
185
Basic usage example:
186
186
187
187
```js
188
-
import { fetch } from'undici';
188
+
import { fetch } from'undici'
189
189
190
190
191
191
constres=awaitfetch('https://example.com')
192
192
constjson=awaitres.json()
193
-
console.log(json);
193
+
console.log(json)
194
194
```
195
195
196
196
You can pass an optional dispatcher to `fetch` as:
@@ -225,29 +225,29 @@ A body can be of the following types:
225
225
In this implementation of fetch, ```request.body``` now accepts ```Async Iterables```. It is not present in the [Fetch Standard.](https://fetch.spec.whatwg.org)
Nodejs has two kinds of streams: [web streams](https://nodejs.org/dist/latest-v16.x/docs/api/webstreams.html), which follow the API of the WHATWG web standard found in browsers, and an older Node-specific [streams API](https://nodejs.org/api/stream.html). `response.body` returns a readable web stream. If you would prefer to work with a Node stream you can convert a web stream using `.fromWeb()`.
@@ -329,6 +329,28 @@ Gets the global dispatcher used by Common API Methods.
329
329
330
330
Returns: `Dispatcher`
331
331
332
+
### `undici.setGlobalOrigin(origin)`
333
+
334
+
* origin `string | URL | undefined`
335
+
336
+
Sets the global origin used in `fetch`.
337
+
338
+
If `undefined` is passed, the global origin will be reset. This will cause `Response.redirect`, `new Request()`, and `fetch` to throw an error when a relative path is passed.
***maxRedirections**`Integer` - Default: `0`. The number of HTTP redirection to follow unless otherwise specified in `DispatchOptions`.
23
+
***interceptors**`{ Agent: DispatchInterceptor[] }` - Default: `[RedirectInterceptor]` - A list of interceptors that are applied to the dispatch method. Additional logic can be applied (such as, but not limited to: 302 status code handling, authentication, cookies, compression and caching). Note that the behavior of interceptors is Experimental and might change at any given time.
0 commit comments