From 106e4d21373b0bdfbf9990f3c8b6db7bca645e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20Crespo?= Date: Thu, 21 Sep 2023 13:25:00 +0000 Subject: [PATCH] Use HTTPName for cookies in response encoders I believe this was an oversight in 27c249ff (included in >= v3.12.0) breaking cookie name mapping to some extent. The upgrade to v3.12.1 in the cookie example shows how the cookie named inadequately changes from `SID` (cookie name) to session_id` (attr name): https://github.com/goadesign/examples/commit/45ca83513f27b41e5351f5cce50e4dd3eaac79b9#diff-c31b43a7b7656de4c0d63b7ac526bfbad82aa335c79f08e186f5d78c6ddc0802R97 --- http/codegen/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http/codegen/server.go b/http/codegen/server.go index 63f5b47ebb..7cc5a03bec 100644 --- a/http/codegen/server.go +++ b/http/codegen/server.go @@ -1335,7 +1335,7 @@ const responseT = `{{ define "response" -}} {{ .VarName }} := "{{ printValue .Type .DefaultValue }}" {{- end }} http.SetCookie(w, &http.Cookie{ - Name: {{ printf "%q" .Name }}, + Name: {{ printf "%q" .HTTPName }}, Value: {{ .VarName }}, {{- if .MaxAge }} MaxAge: {{ .MaxAge }},