-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🐛 [Bug]: Using Head Method Header ContentLength always set and is not zero #2703
Comments
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
It is an automatism, within our kernel, which sets this header automatically and is not a bug This is intentional |
Ok so, how when i want to unset |
Why would you want to do that? |
This is determined automatically based on the content. |
app.Head("/", func(ctx *fiber.Ctx) error {
return ctx.Status(fiber.StatusOK).Send(nil)
}) app.Head("/", func(ctx *fiber.Ctx) error {
// manipulation of the content length
ctx.Response().Header.SetContentLength(10000)
return ctx.Status(fiber.StatusOK).Send(nil)
}) |
Okay cool, can you added to docs? May helpful for anyone with same question |
if it comes up again, I'll add it |
Bug Description
I don't know why fiber always Set Header
ContentLength
with non zero value, even usingHEAD
methodI have try using
ctx.Send(nil)
still same, even i set header manuallyctx.Set(fiber.HeaderContentLength, "")
still didn't workHow to Reproduce
Steps to reproduce the behavior:
go test -v
Expected Behavior
PASS, Header
ContentLength
is not set OR zero valueFiber Version
v2.50.0
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: