Swagger UI does not display image/png content in POST

Viewed 6149

I have a scenario where POST method returns an "image/png" content. The API works perfectly in Postman and I am able to see an image.

I use Swagger to document my APIs. For some reason "Try out" functionality crashes any POST method which returns an image. It freeze on loading and I see the following in the browser console:

cannot parse JSON/YAML content 
swagger-ui-min-js:14 Uncaught TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
at C.n.showStatus (swagger-ui-min-js:14)
at showCompleteStatus (swagger-ui-min-js:14)
at response (swagger-ui-min-js:9)
at h (swagger-ui-min-js:7)
at t.on.response (swagger-ui-min-js:7)
at swagger-ui-min-js:7
at h.callback (swagger-ui-min-js:13)
at h.<anonymous> (swagger-ui-min-js:13)
at h.r.emit (swagger-ui-min-js:13)
at XMLHttpRequest.n.onreadystatechange (swagger-ui-min-js:13)

Any ideas of how this could be fixed? The API works (at least in Postman), it is just the Swagger UI which seems to have a problem. I installed Swagger via nuget packages Swashbuckle.Core and Swashbuckle version 5.6.0

2 Answers
Related