From f568113a58bc7cd5ef5b0c48eb61fe21764c6646 Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sun, 20 Aug 2023 14:04:26 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20only=20set=20`Access-Control-Allow-Cre?= =?UTF-8?q?dentials`=20when=20it=E2=80=99s=20`true`=20(#41)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cors.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cors.go b/cors.go index 9c1a500..13f5da1 100644 --- a/cors.go +++ b/cors.go @@ -110,8 +110,11 @@ func CORS(options ...Options) flamego.Handler { u.Scheme = opt.Scheme } headers["Access-Control-Allow-Origin"] = u.String() - headers["Access-Control-Allow-Credentials"] = strconv.FormatBool(opt.AllowCredentials) headers["Vary"] = "Origin" + + if opt.AllowCredentials { + headers["Access-Control-Allow-Credentials"] = "true" + } } ctx.ResponseWriter().Before(func(w flamego.ResponseWriter) {