Update to go1.21
This commit is contained in:
parent
57780d8004
commit
f29325c679
16 changed files with 59 additions and 67 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"context"
|
||||
"mime"
|
||||
"net/http"
|
||||
"slices"
|
||||
|
||||
"github.com/klauspost/compress/gzhttp"
|
||||
"github.com/opentracing/opentracing-go/ext"
|
||||
|
@ -54,7 +55,7 @@ func (c *compress) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||
log.FromContext(middlewares.GetLoggerCtx(context.Background(), c.name, typeName)).Debug(err)
|
||||
}
|
||||
|
||||
if contains(c.excludes, mediaType) {
|
||||
if slices.Contains(c.excludes, mediaType) {
|
||||
c.next.ServeHTTP(rw, req)
|
||||
} else {
|
||||
ctx := middlewares.GetLoggerCtx(req.Context(), c.name, typeName)
|
||||
|
@ -77,12 +78,3 @@ func (c *compress) gzipHandler(ctx context.Context) http.Handler {
|
|||
|
||||
return wrapper(c.next)
|
||||
}
|
||||
|
||||
func contains(values []string, val string) bool {
|
||||
for _, v := range values {
|
||||
if v == val {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue