Skip to content

Commit

Permalink
Use HTTPName for cookies in response encoders
Browse files Browse the repository at this point in the history
I believe this was an oversight in 27c249f (included in v3.12.0 and newer),
breaking cookie name mapping to some extent.

The upgrade to v3.12.1 in the cookie example shows how the name assigned to the
cookie inadequately changes from `SID` (cookie name) to session_id` (attr name).

goadesign/examples@45ca835#diff-c31b43a7b7656de4c0d63b7ac526bfbad82aa335c79f08e186f5d78c6ddc0802R97
  • Loading branch information
sevein committed Sep 21, 2023
1 parent b86a916 commit c59d563
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http/codegen/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }},
Expand Down

0 comments on commit c59d563

Please sign in to comment.