commit ab034bde5d1035d15b48da4a7f1f954cfb586c48
parent 1f0a2c64900099764bdb533412b02f355d05fdcc
Author: Sebastian <sebasjm@gmail.com>
Date: Mon, 12 May 2025 08:55:22 -0300
increase coverage of workaround for net problem
Diffstat:
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/packages/taler-util/src/http-impl.node.ts b/packages/taler-util/src/http-impl.node.ts
@@ -45,11 +45,12 @@ const https = followRedirects.https;
// 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.
+// The issues is not fixed on 22 and 24.
+// More info https://bugs.gnunet.org/view.php?id=9942
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/)
+ process.versions.node.match(/(20|22|24)\./)
) {
//@ts-ignore
net.setDefaultAutoSelectFamily(false);
@@ -145,7 +146,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
}
if (opt?.body instanceof URLSearchParams) {
- requestHeadersMap["Content-Type"] = "application/x-www-form-urlencoded"
+ requestHeadersMap["Content-Type"] = "application/x-www-form-urlencoded";
}
let path = parsedUrl.pathname;
@@ -191,10 +192,9 @@ export class HttpLibImpl implements HttpRequestLibrary {
return arg + " '" + String(v) + "'";
}
console.log(
- `TALER_API_DEBUG: curl -X ${options.method} "${parsedUrl.href}" ${headers} ${ifUndefined(
- "-d",
- payload,
- )}`,
+ `TALER_API_DEBUG: curl -X ${options.method} "${
+ parsedUrl.href
+ }" ${headers} ${ifUndefined("-d", payload)}`,
);
}
@@ -238,7 +238,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
},
json() {
const text = textDecoder.decode(data);
- const json = JSON.parse(text)
+ const json = JSON.parse(text);
if (logger.shouldLogTrace()) {
logger.trace(`request ${rid} JSON: ${j2s(json)}`);
}
@@ -255,7 +255,9 @@ export class HttpLibImpl implements HttpRequestLibrary {
logger.trace(`request ${rid} status code ${resp.status}`);
doCleanup();
if (SHOW_CURL_HTTP_REQUEST) {
- console.log(`TALER_API_DEBUG: ${res.statusCode} ${textDecoder.decode(data)}`)
+ console.log(
+ `TALER_API_DEBUG: ${res.statusCode} ${textDecoder.decode(data)}`,
+ );
}
resolve(resp);
});