-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Rewrite node:http to not use Request & Response #14384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
❌ @Jarred-Sumner, your commit 1a59948 has some failures in |
will it be available for the first time through the flag? it sounds dangerous if suddenly the insides change so much |
@kravetsone i agree dangerous, but we have far better test coverage than we used to. |
It's great Test coverage can't find all bugs |
super cool |
there was a trick in bun to get the Request object (from a symbol) in node:http: import { createServer } from "http";
createServer(async (req, res) => {
const request: Request = req[Object.getOwnPropertySymbols(req)[3]];
const json = await request.json().catch(() => null);
res.end(json);
}).listen(3000); does this PR mean this is no longer gonna be possible? |
so this idea is completely dismissed or just the pr? |
As a library author this functional approach would be great to have imo since it has less overhead and also more compatible with node and i guess uws. Hope you reconsider ❤️ |
this PR was very stale. we shipped this in Bun v.1.2.6 where we made Express 9% faster, with the actual PR landing the changes in #17093 |
What does this PR do?
Extremely WIP.
Rewrite node:http to not use Request & Response for Bun.serve
Introduce a new internal API that currently looks like this and may change at any point:
This does not replace
fetch
in Bun.serve()How did you verify your code works?
it doesn't really work yet. We aren't emitting
socket
.