Skip to content

feat: add automatic HEAD request generation from GET request#2937

Open
jean0t wants to merge 4 commits intolabstack:masterfrom
jean0t:pr_2895_automatic_head_request
Open

feat: add automatic HEAD request generation from GET request#2937
jean0t wants to merge 4 commits intolabstack:masterfrom
jean0t:pr_2895_automatic_head_request

Conversation

@jean0t
Copy link
Copy Markdown

@jean0t jean0t commented Apr 5, 2026

the behavior is opt-out.

I created one flag in both Echo and Group struct (since they are related to the register of new routes) that is private and a function to explicit cancel this behavior.

Why: Mentioned in the issue #2895 I searched and saw that the default behavior in many frameworks is to automatically register a head request with GET, so I agree with the author of the issue that it should be included to guarantee an expected behavior from the programmer.

I added tests and only modified the high level functions, if the author think it is good and relevant enough to be merged, it will be good.

@aldas
Copy link
Copy Markdown
Contributor

aldas commented Apr 5, 2026

@jean0t I think this would be better approach and more RFC comptible. See #2895 (comment)

@jean0t
Copy link
Copy Markdown
Author

jean0t commented Apr 5, 2026

I dont think it would be optimal to add a middleware if we can have it natively, also as I mentioned, it is the usual behavior in other frameworks.

@jean0t
Copy link
Copy Markdown
Author

jean0t commented Apr 6, 2026

you were right regarding the ResponseWriter, we need to have this to avoid some errors and make the request correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants