Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

Corrupt file is being downloaded with HTTP response 400

Open llmsjraj opened this issue 3 years ago • 4 comments

Version: 6.2.3 Issue: Corrupt file is being downloaded with HTTP response 400

Description: API is returning the binary data with HTTP response 400. Swagger UI is showing the Download File option. However, The downloaded file only has the text OrderedMap {}. The same is working fine with the HTTP response 200.

I have verified the response with Postman and It's valid. The issue with the Swagger. It is not able to download the correct file with the 400 response code.

Here is the specification for the 400 response code.

"400": {
            "description": "400 Bad Request",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "format": "binary",
                  "description": "The body is a binary stream"
                }
              }
            },
            "headers": {
              "Content-Disposition": {
                "schema": {
                  "type": "string"
                },
                "example": "attachment; filename=file.xml; filename*=UTF-8''file.xml",
                "description": "This contains the details of the xml file binary data to download"
              }
            }
          }

llmsjraj avatar Jan 19 '22 08:01 llmsjraj