Browse Source

rpc: allow OPTIONS requests without Content-Type (#15759)

Fixes #15740
Sorin Neacsu 7 years ago
parent
commit
5369a5c54d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      rpc/http.go

+ 1 - 1
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
 	}