1
0
Fork 0

Merge current v2.11 into v3.0

This commit is contained in:
mmatur 2024-03-12 10:38:29 +01:00
commit 05be441027
No known key found for this signature in database
GPG key ID: 2FFE42FC256CFF8E
156 changed files with 5826 additions and 8436 deletions

View file

@ -1,6 +1,7 @@
package types
import (
"slices"
"strconv"
"strings"
)
@ -34,10 +35,7 @@ func NewHTTPCodeRanges(strBlocks []string) (HTTPCodeRanges, error) {
// Contains tests whether the passed status code is within one of its HTTP code ranges.
func (h HTTPCodeRanges) Contains(statusCode int) bool {
for _, block := range h {
if statusCode >= block[0] && statusCode <= block[1] {
return true
}
}
return false
return slices.ContainsFunc(h, func(block [2]int) bool {
return statusCode >= block[0] && statusCode <= block[1]
})
}