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
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When the option addResponseHeaders is enabled for the go-server generator it generates a ResponseWithHeaders method that calls an EncodeJSONResponse method which however ignores the headers that are provided to it.
The generated method looks as follows:
Apparently this is caused by a typo within the mustache template here where the condition refers to addResponseHeader instead of addResponseHeaders as the documentation says and as it is the case other parts of the template.
Fortunately this also means that there's a workaround already by specifying both addResponseHeaders=true and addResponseHeader=true ;)
mgoltzsche
added a commit
to mgoltzsche/openapi-generator
that referenced
this issue
Jun 20, 2021
According to the [documentation](https://openapi-generator.tech/docs/generators/go-server) the go-server generator should support an `addResponseHeaders` option but a template uses an `addResponseHeader` option in some places which this PR fixes.
ClosesOpenAPITools#9795
Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
According to the [documentation](https://openapi-generator.tech/docs/generators/go-server) the go-server generator should support an `addResponseHeaders` option but a template uses an `addResponseHeader` option in some places which this PR fixes.
Closes#9795
Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
Bug Report Checklist
Description
When the option
addResponseHeaders
is enabled for thego-server
generator it generates aResponseWithHeaders
method that calls anEncodeJSONResponse
method which however ignores the headers that are provided to it.The generated method looks as follows:
This stops me from specifying response headers within my controller implementation.
I would expect this method to apply the headers I provided.
openapi-generator version
openapi-generator 5.1.1
OpenAPI declaration file content or url
This is the example OpenAPI schema
example-openapi.yaml
- though you could use any other to reproduce the bug that is described here:Generation Details
Steps to reproduce
see generation details
Related issues/PRs
Suggest a fix
Generate the
EncodeJSONResponse
method so that it applies the provided headers to theResponseWriter
:The text was updated successfully, but these errors were encountered: