core: hide registerHandler (#964)

* core: hide registerHandler

Remove RegisterHandler and just make it implicit when we look at the
handler compilation step.

* Rename GetHandler to just Handler

Update callers and make auto check Hander in OnStartup.

* Up test coverage in erratic

* up test coverage
This commit is contained in:
Miek Gieben
2017-08-22 14:21:42 +01:00
committed by GitHub
parent 65009b5578
commit 8931ede142
11 changed files with 41 additions and 45 deletions

View File

@@ -66,6 +66,10 @@ func NewServer(addr string, group []*Config) (*Server, error) {
var stack middleware.Handler
for i := len(site.Middleware) - 1; i >= 0; i-- {
stack = site.Middleware[i](stack)
// register the *handler* also
site.registerHandler(stack)
if s.trace == nil && stack.Name() == "trace" {
// we have to stash away the middleware, not the
// Tracer object, because the Tracer won't be initialized yet