Skip to content

Commit

Permalink
Logged error in default handler
Browse files Browse the repository at this point in the history
  • Loading branch information
evg4b committed Jan 4, 2024
1 parent cc683a7 commit e65e309
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/handler/uncors_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package handler

import (
"errors"
"github.com/evg4b/uncors/internal/log"
"net/http"
"strings"

Expand Down Expand Up @@ -66,8 +67,9 @@ func NewUncorsRequestHandler(options ...RequestHandlerOption) *RequestHandler {
setDefaultHandler(router, defaultHandler)
}

setDefaultHandler(handler.Router, contracts.HandlerFunc(func(writer contracts.ResponseWriter, _ *http.Request) {
setDefaultHandler(handler.Router, contracts.HandlerFunc(func(writer contracts.ResponseWriter, r *http.Request) {
infra.HTTPError(writer, errHostNotMapped)
log.Errorf("Host %s://%s is not mapped", r.URL.Scheme, r.URL.Host)
}))

return handler
Expand Down

0 comments on commit e65e309

Please sign in to comment.