bun icon indicating copy to clipboard operation
bun copied to clipboard

Implement 103 Early Hints

Open dszymon opened this issue 1 year ago • 4 comments

What is the problem this feature would solve?

Allow developers to push the required resources faster

What is the feature you are proposing to solve the problem?

Add an API to send early hints using Bun.serve() https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103

What alternatives have you considered?

Using node:http

dszymon avatar Feb 05 '24 12:02 dszymon

This is something we could implement, but we'd need to think of an API design for it. Maybe something like this:

Bun.serve({
  async* fetch(request) {
    // Can yield multiple 103 responses
    yield new Response(null, { status: 103 });
    // Must return non-103 response, if yielded
    return new Response(null, { status: 200 });
  },
});

Electroid avatar Feb 05 '24 16:02 Electroid

Any news? It would be a nice feature to have.

According to Cloudflare, Early Hints improve website load times by 30%.

user451421541757324 avatar Feb 02 '25 15:02 user451421541757324

Any news?

gerardmarquinarubio avatar Jun 05 '25 02:06 gerardmarquinarubio

nodejs support writeEarlyHints from 18 version. And I need to rollback to nodejs again.

I use bun for run express. Bun don't sent request for writeEarlyHints, but function is exist and called.

209 avatar Dec 24 '25 02:12 209