From f4afe4108686777e15de47f1d395e1a8bdc6569b Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Thu, 7 Oct 2021 19:22:54 +0300 Subject: [PATCH] [#217] Add headers in response to simple requests Signed-off-by: Angira Kekteeva --- api/handler/cors.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/handler/cors.go b/api/handler/cors.go index 19e4ae80d..de0b24af5 100644 --- a/api/handler/cors.go +++ b/api/handler/cors.go @@ -162,6 +162,7 @@ func (h *handler) AppendCORSHeaders(w http.ResponseWriter, r *http.Request) { for _, m := range rule.AllowedMethods { if m == r.Method { w.Header().Set(api.AccessControlAllowOrigin, origin) + w.Header().Set(api.AccessControlAllowMethods, strings.Join(rule.AllowedMethods, ", ")) w.Header().Set(api.AccessControlAllowCredentials, "true") w.Header().Set(api.Vary, api.Origin) return @@ -178,6 +179,7 @@ func (h *handler) AppendCORSHeaders(w http.ResponseWriter, r *http.Request) { } else { w.Header().Set(api.AccessControlAllowOrigin, o) } + w.Header().Set(api.AccessControlAllowMethods, strings.Join(rule.AllowedMethods, ", ")) return } }