mirror of
https://github.com/safing/portbase
synced 2025-09-01 10:09:50 +00:00
Improve api logging when handler/endpoint does not exist
This commit is contained in:
parent
7799e85d7a
commit
ec1616c1f5
2 changed files with 2 additions and 1 deletions
|
@ -151,7 +151,7 @@ func authenticateRequest(w http.ResponseWriter, r *http.Request, targetHandler h
|
||||||
switch requiredPermission { //nolint:exhaustive
|
switch requiredPermission { //nolint:exhaustive
|
||||||
case NotFound:
|
case NotFound:
|
||||||
// Not found.
|
// Not found.
|
||||||
tracer.Trace("api: authenticated handler reported: not found")
|
tracer.Debug("api: no API endpoint registered for this path")
|
||||||
http.Error(w, "Not found.", http.StatusNotFound)
|
http.Error(w, "Not found.", http.StatusNotFound)
|
||||||
return nil
|
return nil
|
||||||
case NotSupported:
|
case NotSupported:
|
||||||
|
|
|
@ -235,6 +235,7 @@ func (mh *mainHandler) handle(w http.ResponseWriter, r *http.Request) error {
|
||||||
http.Error(lrw, "Method not allowed.", http.StatusMethodNotAllowed)
|
http.Error(lrw, "Method not allowed.", http.StatusMethodNotAllowed)
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
|
tracer.Debug("api: no handler registered for this path")
|
||||||
http.Error(lrw, "Not found.", http.StatusNotFound)
|
http.Error(lrw, "Not found.", http.StatusNotFound)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue