* fix: don't drop handlers that collide with a Mount()/Route() pattern
Mount() (and Route(), which is sugar for it) registers a synthetic
"stub" handler on its exact mount pattern to connect it to the
subrouter. node.routes() used that stub as a signal to hide the whole
node from Routes()/Walk() — but if a real handler was also registered
on that same pattern (e.g. r.Get("/bar", h) next to
r.Route("/bar", ...)), it got hidden too, even though the route is
perfectly routable.
routes() now compares each handler against the stub by identity
(sameHandler, using reflection since http.HandlerFunc isn't ==
comparable) and only hides the stub itself, keeping any real handler
that shares the node. The "*" slot is only filtered on leaf nodes,
since Walk() also reads Handlers["*"] to detect a *ChainHandler and
propagate With() middleware into a subrouter — that entry has to
survive even when it's the same value as the stub.
Fixes#830.
Also adds a regression test for #750 (middlewares registered on a
Group not reaching handlers on a Route() mounted inside it), which
turns out to already be fixed on master — this just locks it in.
* Trim comments in routes() to just the why
* Rename sameHandler to equalHandlers; narrow the reflect switch to Func
Chan, Pointer, and UnsafePointer are already == comparable in Go —
only Func, Map, and Slice aren't, and Map/Slice identity was never a
real case here (the stub is always http.HandlerFunc or *ChainHandler).
* Explain why Routes() reports /api/* and not /api/{id} in TestRoutesHidesMountStub
* Trim comment in TestRoutesHidesMountStub
Add Match(..) bool to chi.Routes, and add middleware.GetHead to automatically route missing head requests to GET handlers
* Put chi.Routes pointer on the route Context instead of having to pass to the middleware
* Rename FindHandler to Find, and add breaking test when searching subtrees
* Rename middleware to GetHead, and update Mux#Find method to search subroutes
* Update README, router at ~1000 LOC
* Redefine Routes#Find(..) http.Handler to Routes#Match(..) bool
* Update benchmarks
* Slightly adjust GetHead middleware to make it clearer