Skip to content

Commit

Permalink
caddyhttp: Alter log message when request is unhandled (close #5182)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed May 10, 2024
1 parent 874d0ce commit 6dce493
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/caddyhttp/caddyhttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ type MiddlewareHandler interface {
}

// emptyHandler is used as a no-op handler.
var emptyHandler Handler = HandlerFunc(func(http.ResponseWriter, *http.Request) error { return nil })
var emptyHandler Handler = HandlerFunc(func(_ http.ResponseWriter, req *http.Request) error {
SetVar(req.Context(), "unhandled", true)
return nil
})

// An implicit suffix middleware that, if reached, sets the StatusCode to the
// error stored in the ErrorCtxKey. This is to prevent situations where the
Expand Down Expand Up @@ -120,7 +123,7 @@ type ResponseHandler struct {
Routes RouteList `json:"routes,omitempty"`
}

// Provision sets up the routse in rh.
// Provision sets up the routes in rh.
func (rh *ResponseHandler) Provision(ctx caddy.Context) error {
if rh.Routes != nil {
err := rh.Routes.Provision(ctx)
Expand Down

0 comments on commit 6dce493

Please sign in to comment.