-
Notifications
You must be signed in to change notification settings - Fork 613
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
Require an HTTP Handler instead of a mux Router in TMDS Config #3666
Conversation
dbb695b
to
7aff351
Compare
@@ -45,7 +45,7 @@ type Config struct { | |||
writeTimeout time.Duration // http server write timeout | |||
steadyStateRate float64 // steady request rate limit | |||
burstRate int // burst request rate limit | |||
router *mux.Router // router with routes configured | |||
handler http.Handler // HTTP handler with routes configured |
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.
clarification: is changing from pointer (*mux.Router) to non pointer http.Handler intentional?
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.
Yeah because http.Handler
is an interface
whereas mux.Router
is a struct
.
Summary
TMDS initialization function in
ecs-agent
module currently requires aRouter
instance from gorilla/mux library to be passed. Usage ofRouter
here is unnecessarily strict and limits the reusability of TMDS to consumers who are using routers from gorilla/mux library. Updating the function to require anhttp.Handler
instance instead which would allow greater reuse.Router
implementshttp.Handler
interface.Implementation details
router *mux.Router
field in TMDS initialization config tohandler http.Handler
.Testing
New tests cover the changes: yes
Description for the changelog
Require an HTTP Handler instead of a mux Router in TMDS Config to increase the reusability of TMDS.
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.