Skip to content

Commit a12ae9d

Browse files
committed
test: Fixed test.
1 parent cd61a9a commit a12ae9d

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,18 @@ implementations in Deno and Cloudflare Workers.
405405

406406
Refs: https://fetch.spec.whatwg.org/#atomic-http-redirect-handling
407407

408+
## Workarounds
409+
410+
### Network address family autoselection.
411+
412+
If you experience problem when connecting to a remote server that is resolved by your DNS servers to a IPv6 (AAAA record)
413+
first, there are chances that your local router or ISP might have problem connecting to IPv6 networks. In that case
414+
undici will throw an error with code `UND_ERR_CONNECT_TIMEOUT`.
415+
416+
If the target server resolves to both a IPv6 and IPv4 (A records) address and you are using a compatible Node version
417+
(18.3.0 and above), you can fix the problem by providing the `autoSelectFamily` option (support by both `undici.request`
418+
and `undici.Agent`) which will enable the family autoselection algorithm when establishing the connection.
419+
408420
## Collaborators
409421

410422
* [__Daniele Belardi__](https://github.com/dnlup), <https://www.npmjs.com/~dnlup>

docs/api/Client.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Returns: `Client`
2828
* **connect** `ConnectOptions | Function | null` (optional) - Default: `null`.
2929
* **strictContentLength** `Boolean` (optional) - Default: `true` - Whether to treat request content length mismatches as errors. If true, an error is thrown when the request content-length header doesn't match the length of the request body.
3030
* **interceptors** `{ Client: 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.
31-
* **autoSelectFamily**: `boolean` (optional) - Enables a family autodetection algorithm that loosely implements section 5 of [RFC 8305](https://tools.ietf.org/html/rfc8305#section-5). See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details. This option is ignored if not supported by the current Node version.
32-
* **autoSelectFamilyAttemptTimeout**: `number` - The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details.
31+
* **autoSelectFamily**: `boolean` (optional) - Default: depends on local Node version, on Node 18.13.0 and above is `false`. Enables a family autodetection algorithm that loosely implements section 5 of [RFC 8305](https://tools.ietf.org/html/rfc8305#section-5). See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details. This option is ignored if not supported by the current Node version.
32+
* **autoSelectFamilyAttemptTimeout**: `number` - Default: depends on local Node version, on Node 18.13.0 and above is `250`. The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. See [here](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) for more details.
3333

3434
#### Parameter: `ConnectOptions`
3535

test/fetch/request.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ const {
1313
Blob: ThirdPartyBlob,
1414
FormData: ThirdPartyFormData
1515
} = require('formdata-node')
16-
const { nodeMajor } = require('../../lib/core/util')
1716

18-
const hasSignalReason = (nodeMajor > 16 || (nodeMajor === 16 && nodeMajor > 14))
17+
const hasSignalReason = 'reason' in AbortSignal.prototype
1918

2019
test('arg validation', async (t) => {
2120
// constructor

0 commit comments

Comments
 (0)