Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
paperclover committed Aug 16, 2023
1 parent 9e418ad commit 2ab9966
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions test/js/node/http/node-http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,20 @@ describe("node:http", () => {
expect(() => validateHeaderValue("Foo", "Bar\r")).toThrow();
});

test("req.req = req", () => {
validateHeaderValue("Foo", "Bar");
expect(() => validateHeaderValue("Foo", undefined as any)).toThrow();
expect(() => validateHeaderValue("Foo", "Bar\r")).toThrow();
test("req.req = req", done => {
const server = createServer((req, res) => {
req.req = req;
res.write(req.req === req ? "ok" : "fail");
res.end();
});
server.listen({ port: 0 }, async (_err, host, port) => {
try {
const x = await fetch(`http://${host}:${port}`).then(res => res.text());
expect(x).toBe("ok");
done();
} catch (error) {
done(error);
}
});
});
});

0 comments on commit 2ab9966

Please sign in to comment.