What is the typeof return to indicate there is empty body return. For example 401 unauthorized returns no body response except 401 status code.
[ProducesResponseType(StatusCodes.Status401Unauthorized)) is showing returning the following in swagger example
{
"type": "string",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
}
I know I'm late to the party on this one, but you can add typeof(void) to the ProducesResponseType like so:
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
This worked for me and is no longer showing a response body in Swagger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With