aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/http.go
diff options
context:
space:
mode:
authorSorin Neacsu <sorin@users.noreply.github.com>2017-12-28 21:15:33 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-12-28 21:15:33 +0800
commit5369a5c54dca1e7b96680997083035a0f9170d60 (patch)
treee4143e701d59e6bf3287c93248a4a1758eb40e4c /rpc/http.go
parent9d187f02389ba12493112c7feb15a83f44e3a3ff (diff)
downloaddexon-5369a5c54dca1e7b96680997083035a0f9170d60.tar.gz
dexon-5369a5c54dca1e7b96680997083035a0f9170d60.tar.zst
dexon-5369a5c54dca1e7b96680997083035a0f9170d60.zip
rpc: allow OPTIONS requests without Content-Type (#15759)
Fixes #15740
Diffstat (limited to 'rpc/http.go')
-rw-r--r--rpc/http.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/rpc/http.go b/rpc/http.go
index a26559b12..d61b0e470 100644
--- a/rpc/http.go
+++ b/rpc/http.go
@@ -177,7 +177,7 @@ func validateRequest(r *http.Request) (int, error) {
return http.StatusRequestEntityTooLarge, err
}
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)
return http.StatusUnsupportedMediaType, err
}