You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Quotes in Content-Type cause "error generating code: error formatting Go code" #1799
package: main
generate:
gorilla-server: true
strict-server: true
output: test.go
The result I get is
error generating code: error formatting Go code
[ ... dump of the code it is trying to generate ... ]
: main.go:221:79: missing ',' in argument list (and 10 more errors)
PR #2217 (merged Feb 13 2026, commit 01d4fc0) fixed this exact bug by introducing StringToGoString() in pkg/codegen/utils.go and updating both buildUnmarshalCase/buildUnmarshalCaseStrict in template_helpers.go and the strict-interface templates to use this function. The fix officially targets issue #1529 which is the same underlying bug. The generated test file internal/test/issues/issue-1529/strict-echo/issue1529.gen.go shows correctly escaped output (e.g. "application/json; profile="Foo""), confirming the fix covers the exact case from issue #1799 (gorilla + strict-server with quoted profile parameter in Content-Type).
Closing as fixed. If you can still reproduce on a recent release, please reopen with the exact spec and version used.
Activity
jamietanna commentedon Nov 3, 2024
Ooh very interesting catch thanks! Yep that's a bug we should address
viktorasm commentedon Mar 15, 2025
@jamietanna posted a proposed fix.
mromaszewicz commentedon May 1, 2026
PR #2217 (merged Feb 13 2026, commit 01d4fc0) fixed this exact bug by introducing StringToGoString() in pkg/codegen/utils.go and updating both buildUnmarshalCase/buildUnmarshalCaseStrict in template_helpers.go and the strict-interface templates to use this function. The fix officially targets issue #1529 which is the same underlying bug. The generated test file internal/test/issues/issue-1529/strict-echo/issue1529.gen.go shows correctly escaped output (e.g. "application/json; profile="Foo""), confirming the fix covers the exact case from issue #1799 (gorilla + strict-server with quoted profile parameter in Content-Type).
Closing as fixed. If you can still reproduce on a recent release, please reopen with the exact spec and version used.
fix: properly handle quotes in content-type when generating server co…
fix: properly handle quotes in content-type when generating server co…