wrapMiddleware wraps mh such that it can be correctly appended to a list of middleware in preparation for compiling into a handler chain.
(ctx caddy.Context, mh MiddlewareHandler)
| 329 | // appended to a list of middleware in preparation for |
| 330 | // compiling into a handler chain. |
| 331 | func wrapMiddleware(ctx caddy.Context, mh MiddlewareHandler) Middleware { |
| 332 | return func(next Handler) Handler { |
| 333 | return HandlerFunc(func(w http.ResponseWriter, r *http.Request) error { |
| 334 | // EXPERIMENTAL: Trace each module that gets invoked |
| 335 | if server, ok := r.Context().Value(ServerCtxKey).(*Server); ok && server != nil { |
| 336 | server.logTrace(mh) |
| 337 | } |
| 338 | return mh.ServeHTTP(w, r, next) |
| 339 | }) |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | // MatcherSet is a set of matchers which |
| 344 | // must all match in order for the request |
no test coverage detected