mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
rpc: use slices.Contains
Signed-off-by: deepdring <deepdrink@icloud.com>
This commit is contained in:
parent
2dbb580f51
commit
b8c237aea8
1 changed files with 3 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue