Skip to content

Commit

Permalink
Drop else
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Jun 14, 2022
1 parent de22c7d commit 3002076
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions handler.go
Expand Up @@ -44,10 +44,9 @@ func (h *Handler) Wrap(next http.Handler) http.Handler {
filter := h.ipFilter.Load().(*ipFilter)
if filter.isAllowed(ip) {
next.ServeHTTP(w, r)
return
} else {
filter.forbiddenHandler.ServeHTTP(w, r)
}

filter.forbiddenHandler.ServeHTTP(w, r)
})
}

Expand All @@ -58,10 +57,9 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
filter := h.ipFilter.Load().(*ipFilter)
if filter.isAllowed(ip) {
h.next.ServeHTTP(w, r)
return
} else {
filter.forbiddenHandler.ServeHTTP(w, r)
}

filter.forbiddenHandler.ServeHTTP(w, r)
}

// Update the handler with a config in a concurrent safe way.
Expand Down

0 comments on commit 3002076

Please sign in to comment.