Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix query params being double-encoded #213

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api_auth.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions api_identity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions api_secrets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions api_system.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions generate/templates/api.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ func ({{lower (substring classname 0 1)}} *{{cut classname "Api"}}) {{nickname}}
requestPath = strings.Replace(requestPath, "{"+"{{baseName}}"+"}", url.PathEscape(requestModifiers.mountPathOr({{#with defaultValue}}{{{.}}}{{/with}})), -1){{/endsWith}}{{/each}}{{#each pathParams}}{{#endsWith baseName "_mount_path"}}{{else}}
requestPath = strings.Replace(requestPath, "{"+"{{baseName}}"+"}", url.PathEscape({{paramName}}), -1){{/endsWith}}{{/each}}

requestQueryParameters := requestModifiers.customQueryParametersOrDefault(){{#each queryParams}}{{#eq paramName "list"}}
requestQueryParameters.Add("{{baseName}}", "true"){{/eq}}{{#neq paramName "list"}}
requestQueryParameters.Add("{{baseName}}", url.QueryEscape(parameterToString({{paramName}}))){{/neq}}{{/each}}
requestQueryParameters := requestModifiers.customQueryParametersOrDefault()
{{~#each queryParams}}
{{~#eq paramName "list"}}
requestQueryParameters.Add("{{baseName}}", "true")
{{~else}}
requestQueryParameters.Add("{{baseName}}", parameterToString({{paramName}}))
{{~/eq}}
{{~/each}}

{{#each bodyParams}}
return sendStructuredRequestParseResponse[{{#with returnType}}schema.{{{.}}}{{/with}}{{#unless returnType}}map[string]interface{}{{/unless}}](
Expand Down