Skip to content
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

fix(HTTP Server): can't set custom statusText #10266

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

coratgerl
Copy link
Contributor

@coratgerl coratgerl commented Apr 14, 2024

What does this PR do?

On node we can change the statusText in the Response. On Bun, Bun.serve and createServer from node:http only returns the default statusText define here https://github.com/oven-sh/bun/blob/main/src/bun.js/api/server.zig#L1039.

So actually the two following code doesn't change the statusText

Bun.serve({
  fetch(request) {
    return new Response(request.url, {
      statusText: "customStatusText",
    });
  },
  port: 0,
});
import { createServer } from 'node:http'

const server = createServer((req, res) => {
	res.writeHead(200, 'statusMessage')
	res.end('Hello World\n')
})

server.listen(3000)
  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

I wrote automated tests

@coratgerl coratgerl changed the title fix: custom statusText fix(HTTP Server): can't set custom statusText Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant