diff options
author | Sebastian <sebasjm@gmail.com> | 2023-07-10 09:43:08 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-07-10 09:43:08 -0300 |
commit | f6b63a691b63ac2fab335cde3307f8d2b966a558 (patch) | |
tree | 07bbf062d83b15ef16c09c1abaa60418c1bad698 /packages/taler-util/src | |
parent | e0c4c2155f6d64a28a9e6c6f5b26773f3833b0fc (diff) | |
download | wallet-core-f6b63a691b63ac2fab335cde3307f8d2b966a558.tar.xz |
fix node20 bug
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r-- | packages/taler-util/src/http-impl.node.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/taler-util/src/http-impl.node.ts b/packages/taler-util/src/http-impl.node.ts index 4df1feaf0..639043201 100644 --- a/packages/taler-util/src/http-impl.node.ts +++ b/packages/taler-util/src/http-impl.node.ts @@ -21,6 +21,7 @@ */ import * as http from "node:http"; import * as https from "node:https"; +import * as net from "node:net"; import { RequestOptions } from "node:http"; import { TalerError } from "./errors.js"; import { encodeBody, getDefaultHeaders, HttpLibArgs } from "./http-common.js"; @@ -39,6 +40,19 @@ import { URL, } from "./index.js"; +// Work around a node v20.0.0, v20.1.0, and v20.2.0 bug. The issue was fixed +// in v20.3.0. +// https://github.com/nodejs/node/issues/47822#issuecomment-1564708870 +// Safe to remove once support for Node v20 is dropped. +if ( + // check for `node` in case we want to use this in "exotic" JS envs + process.versions.node && + process.versions.node.match(/20\.[0-2]\.0/) +) { + //@ts-ignore + net.setDefaultAutoSelectFamily(false); +} + const logger = new Logger("http-impl.node.ts"); const textDecoder = new TextDecoder(); @@ -126,6 +140,7 @@ export class HttpLibImpl implements HttpRequestLibrary { method: method, path, headers: requestHeadersMap, + timeout: timeoutMs, }; const chunks: Uint8Array[] = []; |