mirror of
https://github.com/denoland/deno.git
synced 2025-01-07 22:58:24 -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/");
|
const { promise, resolve } = Promise.withResolvers<void>();
|
||||||
req.on("error", () => {});
|
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
|
// @ts-expect-error - null is not a valid header value
|
||||||
req.setHeader("foo", null);
|
req.setHeader("foo", null);
|
||||||
req.end();
|
req.end();
|
||||||
req.destroy();
|
await promise;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const req = https.request("https://localhost:4545/");
|
const { promise, resolve } = Promise.withResolvers<void>();
|
||||||
req.on("error", () => {});
|
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
|
// @ts-expect-error - null is not a valid header value
|
||||||
req.setHeader("foo", null);
|
req.setHeader("foo", null);
|
||||||
req.end();
|
req.end();
|
||||||
req.destroy();
|
|
||||||
|
await promise;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue