mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
rpc: Allow OPTIONS requests without Content-type: application/json
This commit is contained in:
parent
9d187f0238
commit
6007bf967b
1 changed files with 1 additions and 1 deletions
|
|
@ -177,7 +177,7 @@ func validateRequest(r *http.Request) (int, error) {
|
||||||
return http.StatusRequestEntityTooLarge, err
|
return http.StatusRequestEntityTooLarge, err
|
||||||
}
|
}
|
||||||
mt, _, err := mime.ParseMediaType(r.Header.Get("content-type"))
|
mt, _, err := mime.ParseMediaType(r.Header.Get("content-type"))
|
||||||
if err != nil || mt != contentType {
|
if r.Method != http.MethodOptions && (err != nil || mt != contentType) {
|
||||||
err := fmt.Errorf("invalid content type, only %s is supported", contentType)
|
err := fmt.Errorf("invalid content type, only %s is supported", contentType)
|
||||||
return http.StatusUnsupportedMediaType, err
|
return http.StatusUnsupportedMediaType, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue