Bug Description
request() does not reject highWaterMark: NaN during option validation.
Reproducible By
import { createServer } from "node:http";
import { Client } from "undici";
const server = createServer((req, res) => {
console.log("server: received request");
res.writeHead(200, { "content-type": "text/plain" });
res.end("hello");
});
server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`);
client.request(
{
path: "/",
method: "GET",
highWaterMark: Number.NaN,
},
(err, data) => {
console.log("callback err:", {
name: err?.name,
code: err?.code,
message: err?.message,
});
console.log("callback data exists:", !!data);
client.close();
server.close();
},
);
});
Expected Behavior
Undici should reject highWaterMark: NaN up front during request option validation, consistently with other invalid highWaterMark values such as strings and negative numbers.
The error should be InvalidArgumentError('invalid highWaterMark'), and the request should not proceed far enough to create the response body stream.
Logs & Screenshots
server: received request
callback err: {
name: 'TypeError',
code: 'ERR_INVALID_ARG_VALUE',
message: "The property 'options.highWaterMark' is invalid. Received NaN"
}
callback data exists: true
Environment
macOS 26.4.1
Node v24.14.1
undici v8.1.0
Bug Description
request()does not rejecthighWaterMark: NaNduring option validation.Reproducible By
Expected Behavior
Undici should reject
highWaterMark: NaNup front during request option validation, consistently with other invalidhighWaterMarkvalues such as strings and negative numbers.The error should be
InvalidArgumentError('invalid highWaterMark'), and the request should not proceed far enough to create the response body stream.Logs & Screenshots
Environment
macOS 26.4.1
Node v24.14.1
undici v8.1.0