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
I have a spec, where a PUT request has no request body, only a response body defined:
'/redacted':
put:
security:
- BearerAuth: []
parameters:
- description: Redacted
in: path
name: user
required: true
schema:
$ref: '#/components/schemas/ObjectId'
- description: The ID of the segment
in: path
name: segment
required: true
schema:
$ref: '#/components/schemas/ObjectId'
responses:
'200':
content:
application/json; charset=utf-8:
schema:
$ref: '#/components/schemas/ResponseMessage'
example:
message: user removed from segment
description: OK
Nswag studio generates an empty body for the content with the content type of the response. The generated code looks like this: request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json; charset=utf-8");
This causes an exception since the Encoding and mediatype are to be separately defined in the StringContent constructor. Removing the charset=utf-8 manually solved the issue, but I worry that this error will sneak in again when a new spec is generated. Could you solve this issue?
Kind regards
The text was updated successfully, but these errors were encountered:
I have a spec, where a PUT request has no request body, only a response body defined:
Nswag studio generates an empty body for the content with the content type of the response. The generated code looks like this:
request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json; charset=utf-8");
This causes an exception since the Encoding and mediatype are to be separately defined in the StringContent constructor. Removing the charset=utf-8 manually solved the issue, but I worry that this error will sneak in again when a new spec is generated. Could you solve this issue?
Kind regards
The text was updated successfully, but these errors were encountered: