When using produces or consumes in the swagger description there's currently a case mismatch between the casing of the code generator and superagent.
In my specific case, I have an endpoint consuming text/csv. Apparently, the body is of type string.
Internally, when sending a string to the endpoint res.send(body) is called. In the send method, superagent gets the content-type header (lower case, see here).
If it doesn't find it, the content type is overriden and set to application/x-www-form-urlencoded. Thus, my string body is sent as [object Object] to the backend because the content is transformed. This happens here.
If somebody considers this as a breaking change, I would also be happy by introducing a lowerCaseName field which then can be used in mustache files. However, I think sticking to the lower case header names convention of superagent is the better way to solve the issue.
When using
produces
orconsumes
in the swagger description there's currently a case mismatch between the casing of the code generator and superagent.In my specific case, I have an endpoint consuming
text/csv
. Apparently, the body is of typestring
.Internally, when sending a string to the endpoint
res.send(body)
is called. In thesend
method, superagent gets thecontent-type
header (lower case, see here).If it doesn't find it, the content type is overriden and set to
application/x-www-form-urlencoded
. Thus, my string body is sent as[object Object]
to the backend because the content is transformed. This happens here.If somebody considers this as a breaking change, I would also be happy by introducing a
lowerCaseName
field which then can be used in mustache files. However, I think sticking to the lower case header names convention of superagent is the better way to solve the issue.Microsoft Reviewers: Open in CodeFlow