Skip to content

Commit

Permalink
Nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Aug 22, 2024
1 parent e916b97 commit 971111e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/api/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import (
func RequestTimeout(timeout time.Duration, skipper func(echo.Context) bool) echo.MiddlewareFunc {
return func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
if skipper(c) {
return next(c)
if skipper != nil {
if skipper(c) {
return next(c)
}
}

timeoutCtx, cancel := context.WithTimeout(c.Request().Context(), timeout)
Expand Down

0 comments on commit 971111e

Please sign in to comment.