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
If a endpoint is able to consume different content types e.g. like:
"application/json",
"text/json",
"application/xml",
"text/xml",
"application/x-www-form-urlencoded"
then in general Nswag tries to use "application/json" if available. (see here and below lines)
Additionally to that, the content type in the header is not set to "application/x-www-form-urlencoded" but to "application/json" as it is the default value for "operation.Consumes" when available.
I like that "application/json" is used as default and it should stay like that, but then the client has to check this at first and don't do this at the end if no other supported content type was used.
Additionally, if other content types are used and "application/json" is supported, the content type should be set to the actual used value.
The text was updated successfully, but these errors were encountered:
Describe the bug
If a endpoint is able to consume different content types e.g. like:
"application/json",
"text/json",
"application/xml",
"text/xml",
"application/x-www-form-urlencoded"
then in general Nswag tries to use "application/json" if available. (see here and below lines)
NSwag/src/NSwag.CodeGeneration/Models/OperationModelBase.cs
Line 246 in 8369a99
However, if the endpoint supports also FormUrlEncoded content, this is used rather than "application/json" in the Client:
NSwag/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid
Line 215 in 8369a99
Additionally to that, the content type in the header is not set to "application/x-www-form-urlencoded" but to "application/json" as it is the default value for "operation.Consumes" when available.
NSwag/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid
Line 219 in 8369a99
The content is only serialized as "application/json" if no other content type is supported (see this line and following)
NSwag/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid
Line 223 in 8369a99
Version used
v14.2.0
Expected behavior
I like that "application/json" is used as default and it should stay like that, but then the client has to check this at first and don't do this at the end if no other supported content type was used.
Additionally, if other content types are used and "application/json" is supported, the content type should be set to the actual used value.
The text was updated successfully, but these errors were encountered: