bun
bun copied to clipboard
Response doesn't stream when `Transfer-Encoding` is set to `chunked` in express.js
What version of Bun is running?
0.5.6
What platform is your computer?
Darwin 22.2.0 arm64 arm
What steps can reproduce the bug?
- Run repro script:
curl https://gist.githubusercontent.com/noway/7097e86dc5650a762b156a63e43ff6d7/raw/da6c5a8cf31bb4b33ed314dfd71c15bf9eb920e9/bun-express-streaming-response-bug.sh | bash
- Alternatively, go to https://gist.github.com/noway/7097e86dc5650a762b156a63e43ff6d7 and copy-paste the script into Terminal.
- Run
curl localhost:3001in Terminal - Run
curl localhost:3002in Terminal - See the difference between step 2 and step 3. Port
3002(node) is streaming. Port3001(bun) is not streaming.
What is the expected behavior?
The expected behaviour is for bun (port 3001) to stream (display the output line-by-line, waiting 300 ms in-between every line) just like node (port 3002) does.
What do you see instead?
Bun doesn't stream, it spits out the response as a whole when res.end() is called.
Additional information
N/A