Closed alehano closed 7 years ago
Regarding Config - judging from the source code it's done automatically for new sub-routers as long as you use Route method. If you wish to explicitly mount the sub-router - you will have to initialize it correctly.
While Config approach is simpler, the middleware approach is more explicit and doesn't introduce this fix into the core of this router. That alone will allow us to use corrent "dirty" fix (documenting the fact, that headers will not be stripped from the resulting response) and introduce the proper one (once this https://github.com/golang/go/issues/4146 or https://github.com/golang/go/issues/16522 will be resolved) without breaking existing code.That and @VojtechVitek points about dynamic routing.
yea, I think #248 is better too because it keeps the core lean and extends the api slightly to offer more power for people to program their own middlewares to change routing behaviour for their needs.
btw, @VojtechVitek - FindHandler
requires the *Context
because its actually doing routing through the tree, where it stores the url param values during traversal. Perhaps there is a better name than FindHandler
, as what its doing is Routing the method and path to a handler. Maybe, Traverse(...) http.Handler
or Seek(...) http.Handler
or Match(...) http.Handler
@lwc @alehano @Vektah @c2h5oh any thoughts on the matter?
I agree with @VojtechVitek thoughts. I prefer #248 approach.
please review #248 again when you guys have a sec
merged #248
Thanks! :+1:
Standard go http router allows to do HEAD requests to GET endpoints and return the same response but without body. Chi response 405 for GET routes with HEAD method.