From 6007bf967bb009622f9ce322e14f17f030736f6b Mon Sep 17 00:00:00 2001 From: Sorin Neacsu Date: Tue, 26 Dec 2017 10:05:53 -0800 Subject: [PATCH] rpc: Allow OPTIONS requests without Content-type: application/json --- rpc/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc/http.go b/rpc/http.go index a26559b122..d61b0e470b 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 }