send-type sets header content-length when status code is 204 (no-content)
Closed this issue · 1 comments
BenjaminGlusa commented
** Affected version **
"@polka/send-type": "0.5.2",
"polka": "0.5.2"
Steps to reproduce:
- Start polka webserver:
const polka = require('polka');
const send = require('@polka/send-type');
const app = polka().listen(8085, err => {
if (err) throw err;
console.log(`> Running on localhost: 8085`);
});
app.get('/test', (req, res) => {
send(res, 204);
});
- Send request (e.g. with curl):
curl -v http://localhost:8085/test
Expected Result
Response header content-length
is 0 or unset
Actual Result
Response header content-length
is 10
Impact
Some rest clients (postman) will wait 5 seconds for the content to be received.
lukeed commented
Hey,
This is solved in @polka/send@next
: https://github.com/lukeed/polka/blob/next/packages/send/index.js#L41-L46
(For the next
version, @polka/send-type
has been renamed to @polka/send
)
You can actually use that package today without updating anything else to its next
variant.
Thank you for the report though!