mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(ext/node): allow null value for req.setHeader (#21391)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
2b3daa690d
commit
3a74fa60ca
2 changed files with 20 additions and 1 deletions
|
@ -835,3 +835,22 @@ Deno.test("[node/https] node:https exports globalAgent", async () => {
|
|||
"node:https must export 'globalAgent' on module default export",
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("[node/http] node:http request.setHeader(header, null) doesn't throw", () => {
|
||||
{
|
||||
const req = http.request("http://localhost:4545/");
|
||||
req.on("error", () => {});
|
||||
// @ts-expect-error - null is not a valid header value
|
||||
req.setHeader("foo", null);
|
||||
req.end();
|
||||
req.destroy();
|
||||
}
|
||||
{
|
||||
const req = https.request("https://localhost:4545/");
|
||||
req.on("error", () => {});
|
||||
// @ts-expect-error - null is not a valid header value
|
||||
req.setHeader("foo", null);
|
||||
req.end();
|
||||
req.destroy();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -249,7 +249,7 @@ export class OutgoingMessage extends Stream {
|
|||
}
|
||||
|
||||
name = name.toString();
|
||||
headers[name.toLowerCase()] = [name, value.toString()];
|
||||
headers[name.toLowerCase()] = [name, String(value)];
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue