swagger-api / swagger-api/swagger-ui

Last-modified response header date-time wrongly formatted in Response headers box

Open
#8,178 1 comment 1 reaction 0 assignees View on GitHub

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:

  1. Go to swagger-ui
  2. Click on Try it out and Execute request returning Last-modified
  3. Scroll down to Response headers
  4. See how Last-modified is 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:

Zrzut ekranu 2022-09-9 o 12 31 14

Swagger response headers box:

Zrzut ekranu 2022-09-9 o 12 31 27

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.