提交 5369a5c5 编写于 作者: S Sorin Neacsu 提交者: Felix Lange

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

Fixes #15740
上级 9d187f02
......@@ -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
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册