-
Notifications
You must be signed in to change notification settings - Fork 97
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
HTTP HEAD can not get the content-length(always 0) #447
Comments
I think this is more like a feature tho For HEAD routes, we are not sending the body so the content-length is always 0, but the RFC stands that the server MAY sent the real content-length without the payload |
It is actually a regression introduced in #436 |
Released in |
Prerequisites
Fastify version
4.26.2
Plugin version
7.0.2
Node.js version
18.19.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 22.04.4 LTS
Description
Just write a simple static files server.
Then HTTP HEAD method to get an exists file info:
curl -I http://localhost:8089/x.txt
The wrong is the headRouteOnSendHandler(
fastify/lib/headRoute.js
) rewrite the content-length to 0.remove this should be ok.
Steps to Reproduce
Server:
Client:
curl -I http://localhost:8089/x.txt
Expected Behavior
Get the file size correctly.
The text was updated successfully, but these errors were encountered: