1
0
Fork 0

Update to go1.21

This commit is contained in:
Ludovic Fernandez 2023-08-16 17:50:06 +02:00 committed by GitHub
parent 57780d8004
commit f29325c679
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 59 additions and 67 deletions

View file

@ -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
}