diff --git a/rpc/http.go b/rpc/http.go index f4b99429ef..48cb22edee 100644 --- a/rpc/http.go +++ b/rpc/http.go @@ -27,6 +27,7 @@ import ( "mime" "net/http" "net/url" + "slices" "strconv" "sync" "time" @@ -351,10 +352,8 @@ func (s *Server) validateRequest(r *http.Request) (int, error) { } // Check content-type if mt, _, err := mime.ParseMediaType(r.Header.Get("content-type")); err == nil { - for _, accepted := range acceptedContentTypes { - if accepted == mt { - return 0, nil - } + if slices.Contains(acceptedContentTypes, mt) { + return 0, nil } } // Invalid content-type