Skip to content

Commit

Permalink
If no route is selected, metal-api crashes with a npe (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 authored Oct 10, 2023
1 parent be35762 commit 34d00cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions auditing/auditing-interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ func HttpFilter(a Auditing, logger *zap.SugaredLogger) restful.FilterFunction {
case http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete:
break
default:
if request.SelectedRoute() == nil {
logger.Debugw("selected route is not defined, continue request processing")
chain.ProcessFilter(request, response)
return
}
included, ok := request.SelectedRoute().Metadata()[Include].(bool)
if ok && included {
break
Expand Down

0 comments on commit 34d00cc

Please sign in to comment.