From f74585ff01c9be796fb5bb678f8cbf80544f44eb Mon Sep 17 00:00:00 2001 From: dave caruso Date: Thu, 17 Aug 2023 14:57:43 -0700 Subject: Allow IncomingRequest.req to be overwritten. (#4154) * Allow IncomingRequest.req to be overwritten. * add test * fix test * yoo --- test/js/node/http/node-http.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/js/node/http/node-http.test.ts') diff --git a/test/js/node/http/node-http.test.ts b/test/js/node/http/node-http.test.ts index e8fe4dae8..6dca23547 100644 --- a/test/js/node/http/node-http.test.ts +++ b/test/js/node/http/node-http.test.ts @@ -733,4 +733,21 @@ describe("node:http", () => { 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); + } + }); + }); }); -- cgit v1.2.3