oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.32k stars 2.78k forks source link

can't set statusText #13817

Open lanezhao opened 2 months ago

lanezhao commented 2 months ago

What version of Bun is running?

1.1.27+267afa293

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

Set statusText not working. It's a basically need when create http server. Please fix it.

const port = 4444;

bun.serve({
  port,
  fetch() {
    return new Response('', {
      statusText: 'customStatusText',
    });
  },
});

const host = `http://localhost:${port}`;

await fetch(`${host}`)
  .then((res) => {
    console.debug({ statusText: res.statusText });
  });

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

coratgerl commented 2 months ago

A PR is open to fix this

https://github.com/oven-sh/bun/pull/10266

lanezhao commented 2 months ago

A PR is open to fix this

10266

I know, but it seems to have lasted for a long time. It shouldn't be a complicated bug. I hope it can be fixed soon.

usually put the debug info in statusText of 400 error code. But now the problem forces me to add debug field in body to solve this problem. I don't think this is a perfect solution.

lanezhao commented 1 month ago

Is there a plan or schedule to fix this? Or is it not being fixed in the near future? If possible, please provide some feedback on this issue.

lanezhao commented 2 weeks ago

Can same one respond? This is a major issue when creating web servers with Bun.js. I think it's not so difficult to fix. @Jarred-Sumner @dylan-conway Please!!!