Wrap handler easily#289
Open
champon1020 wants to merge 3 commits intojulienschmidt:masterfrom
Open
Conversation
julienschmidt
requested changes
Jan 6, 2020
Owner
julienschmidt
left a comment
There was a problem hiding this comment.
In general this change absolutely makes sense. Thank you!
Kindly change the godoc for ServeHTTP as written above, though.
| // wildcards (path variables). | ||
| type Handle func(http.ResponseWriter, *http.Request, Params) | ||
|
|
||
| // ServeHTTP calls function type of Handle. |
Owner
There was a problem hiding this comment.
Please align this with the comment for http.HandlerFunc.ServeHTTP: ServeHTTP calls h(w, r, ps).
Author
There was a problem hiding this comment.
Thank you for reviewing my code!
I've just fixed the comment that you have pointed out.
|
Could you merge this? |
Author
|
@fsaintjacques I'm sorry I can't, I have no right to merge without approval. |
|
@julienschmidt gentle ping. |
similark
pushed a commit
to similarweb/httprouter
that referenced
this pull request
May 9, 2023
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
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.
Why
Because I want to use middleware in the way which is similar to net/http.
How to fix
I added method of ServeHTTP to httprouter.Handle.
Then, you can use middleware like this.
Additional
Created test.