|
|
|
@ -139,12 +139,12 @@ func NewServer(opts ...ServerOption) *Server { |
|
|
|
|
for _, o := range opts { |
|
|
|
|
o(srv) |
|
|
|
|
} |
|
|
|
|
srv.router = mux.NewRouter() |
|
|
|
|
srv.router.Use(srv.filter()) |
|
|
|
|
srv.Server = &http.Server{ |
|
|
|
|
Handler: FilterChain(srv.filters...)(srv), |
|
|
|
|
Handler: FilterChain(srv.filters...)(srv.router), |
|
|
|
|
TLSConfig: srv.tlsConf, |
|
|
|
|
} |
|
|
|
|
srv.router = mux.NewRouter() |
|
|
|
|
srv.router.Use(srv.filter()) |
|
|
|
|
return srv |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -170,7 +170,7 @@ func (s *Server) HandleFunc(path string, h http.HandlerFunc) { |
|
|
|
|
|
|
|
|
|
// ServeHTTP should write reply headers and data to the ResponseWriter and then return.
|
|
|
|
|
func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request) { |
|
|
|
|
s.router.ServeHTTP(res, req) |
|
|
|
|
s.Handler.ServeHTTP(res, req) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (s *Server) filter() mux.MiddlewareFunc { |
|
|
|
|