Skip to content

Commit

Permalink
panic on aborted requests to properly close the connection
Browse files Browse the repository at this point in the history
  • Loading branch information
tonybart1337 committed Sep 26, 2024
1 parent f8a78b3 commit 0a589bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/middlewares/recovery/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func recoverFunc(rw http.ResponseWriter, req *http.Request) {
logger := middlewares.GetLogger(req.Context(), middlewareName, typeName)
if !shouldLogPanic(err) {
logger.Debug().Msgf("Request has been aborted [%s - %s]: %v", req.RemoteAddr, req.URL, err)
return
panic(http.ErrAbortHandler)
}

logger.Error().Msgf("Recovered from panic in HTTP handler [%s - %s]: %+v", req.RemoteAddr, req.URL, err)
Expand Down

0 comments on commit 0a589bd

Please sign in to comment.