swagger-api / swagger-api/swagger-ui
Response Body not shown when Content-Type in the response header is not set
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: chrome
- Method of installation: dist
- Swagger-UI version: 3.26.2
- Swagger/OpenAPI version: OpenAPI 3.0
Describe the bug you're encountering
When the Content-Type response header is not set, swagger-ui does not show the Response Body. I am seeing this issue when using OpenAPI 3.0 with swagger-ui 3.26.2

When using Swagger 2.0 with swagger-ui 2.2.10, we do see Response Body even when the Content-Type response header is not set.

As you can see in the above picture, the Content-Type is set to null
So I am wondering if there is any way for swagger-ui(3.26.2) to show the Response Body even when the Content-Type response header is not set
Additional context or thoughts
I can confirm that if I pass in the Content-Type response header, the Response Body is seen like below

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in Swagger UI 3.26.2 with an OpenAPI 3.0 response that lacks a Content-Type header, then compare it with the reported Swagger 2.0 behavior. The work is complete when Swagger UI displays the response body despite the missing response header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100