feat: add automatic HEAD request generation from GET request#2937
Open
jean0t wants to merge 4 commits intolabstack:masterfrom
Open
feat: add automatic HEAD request generation from GET request#2937jean0t wants to merge 4 commits intolabstack:masterfrom
jean0t wants to merge 4 commits intolabstack:masterfrom
Conversation
Contributor
|
@jean0t I think this would be better approach and more RFC comptible. See #2895 (comment) |
Author
|
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. |
Author
|
you were right regarding the ResponseWriter, we need to have this to avoid some errors and make the request correct |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.