swagger-api / swagger-api/swagger-ui
Last-modified response header date-time wrongly formatted in Response headers box
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A
- OS: macOS Monterey 12.4
- Browser: Chrome
- Version: 105.0.5195.102 (arm64)
- Method of installation: docker
- Swagger-UI version: 4.14.0
- OpenAPI version: OpenAPI 3.0.0
Content & configuration
Example Swagger/OpenAPI definition:
(...)
200:
description: (...)
headers:
Last-Modified:
description: (...)
schema:
type: string
format: HTTP-date
example: Fri, 27 Sep 2019 11:00:00 GMT
(...)
Swagger-UI is in it's default configuration.
Describe the bug you're encountering
When testing an endpoint that is returning http Last-modified header, in the swagger Response headers box, instead of having them displayed raw as they are returned from the server, headers are lowercased (not an issue) and Last-modified is reformatted in a way that it no longer conforms to HTTP-date format (RFC2616)
Sending it in this format in If-Modified-Since header may then result in ignoring it as that's what http protocol tells to do (RFC7232).
To reproduce...
Nothing special:
- Go to
swagger-ui - Click on
Try it outandExecuterequest returningLast-modified - Scroll down to
Response headers - See how
Last-modifiedis wrongly formatted
Expected behavior
Instead of Fri,20 Jul 2018 20:23:07 GMT, it should be Fri, 20 Jul 2018 20:23:07 GMT
Screenshots
Server response headers:
Swagger response headers box:
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
Reproduce the issue in Swagger UI by executing an endpoint that returns a Last-Modified response header and inspect the Response headers box. Confirm that the displayed value preserves the HTTP-date spacing, including the space after the comma, and verify the result against the reported expected value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100