-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Wrap handler easily #289
base: master
Are you sure you want to change the base?
Wrap handler easily #289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this change absolutely makes sense. Thank you!
Kindly change the godoc for ServeHTTP as written above, though.
router.go
Outdated
@@ -88,6 +88,11 @@ import ( | |||
// wildcards (path variables). | |||
type Handle func(http.ResponseWriter, *http.Request, Params) | |||
|
|||
// ServeHTTP calls function type of Handle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please align this with the comment for http.HandlerFunc.ServeHTTP
: ServeHTTP calls h(w, r, ps)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for reviewing my code!
I've just fixed the comment that you have pointed out.
Could you merge this? |
@fsaintjacques I'm sorry I can't, I have no right to merge without approval. |
@julienschmidt gentle ping. |
Signed-off-by: Aaron Schlesinger <[email protected]>
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.