swagger-api / swagger-api/swagger-ui

Response Body not shown when Content-Type in the response header is not set

Open
#6,149 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Hacktoberfest specification: 3.x type: bug
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
Screen Shot 2020-06-15 at 5 41 59 PM

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.
Screen Shot 2020-06-15 at 5 44 32 PM

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

Screen Shot 2020-06-15 at 5 53 08 PM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.