From 5369a5c54dca1e7b96680997083035a0f9170d60 Mon Sep 17 00:00:00 2001 From: Sorin Neacsu Date: Thu, 28 Dec 2017 05:15:33 -0800 Subject: rpc: allow OPTIONS requests without Content-Type (#15759) Fixes #15740 --- rpc/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rpc/http.go') 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 } -- cgit v1.2.3