diff options
Diffstat (limited to 'test/js/node/http/node-http.test.ts')
-rw-r--r-- | test/js/node/http/node-http.test.ts | 17 |
1 files changed, 17 insertions, 0 deletions
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); + } + }); + }); }); |