mirror of
https://github.com/denoland/deno.git
synced 2025-01-06 22:35:51 -05:00
modify test to avoid op leaks
This commit is contained in:
parent
b276d38671
commit
ace7f8bbd6
1 changed files with 18 additions and 7 deletions
|
@ -1075,22 +1075,33 @@ Deno.test("[node/https] node:https exports globalAgent", async () => {
|
|||
);
|
||||
});
|
||||
|
||||
Deno.test("[node/http] node:http request.setHeader(header, null) doesn't throw", () => {
|
||||
Deno.test("[node/http] node:http request.setHeader(header, null) doesn't throw", async () => {
|
||||
{
|
||||
const req = http.request("http://localhost:4545/");
|
||||
req.on("error", () => {});
|
||||
const { promise, resolve } = Promise.withResolvers<void>();
|
||||
const req = http.request("http://localhost:4545/", (res) => {
|
||||
res.on("data", () => {});
|
||||
res.on("end", () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
// @ts-expect-error - null is not a valid header value
|
||||
req.setHeader("foo", null);
|
||||
req.end();
|
||||
req.destroy();
|
||||
await promise;
|
||||
}
|
||||
{
|
||||
const req = https.request("https://localhost:4545/");
|
||||
req.on("error", () => {});
|
||||
const { promise, resolve } = Promise.withResolvers<void>();
|
||||
const req = http.request("http://localhost:4545/", (res) => {
|
||||
res.on("data", () => {});
|
||||
res.on("end", () => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
// @ts-expect-error - null is not a valid header value
|
||||
req.setHeader("foo", null);
|
||||
req.end();
|
||||
req.destroy();
|
||||
|
||||
await promise;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue