diff options
author | 2023-08-17 14:57:43 -0700 | |
---|---|---|
committer | 2023-08-17 14:57:43 -0700 | |
commit | f74585ff01c9be796fb5bb678f8cbf80544f44eb (patch) | |
tree | 3b650a02d326c94e589d4bf5b0d7ccf191c4e431 /test/js/node/http/node-http.test.ts | |
parent | b2f8ef4dff8c4fa0a12f3d11520bb0609bbaecde (diff) | |
download | bun-f74585ff01c9be796fb5bb678f8cbf80544f44eb.tar.gz bun-f74585ff01c9be796fb5bb678f8cbf80544f44eb.tar.zst bun-f74585ff01c9be796fb5bb678f8cbf80544f44eb.zip |
Allow IncomingRequest.req to be overwritten. (#4154)
* Allow IncomingRequest.req to be overwritten.
* add test
* fix test
* yoo
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); + } + }); + }); }); |