swagger-api / swagger-api/swagger-ui

Cookie parameters not sent

Open
#8,325 2 comments 5 reactions 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 (please complete the following information)
  • OS: macOS and Windows
  • Browser: chrome
  • Version: 108.0.5359.98(Chrome Version)
  • Method of installation: npm
  • Swagger-UI version: latest (v4.15.5)
  • Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration

I enter a value in the cookie parameter and execute it, but it is not set in the Request Header.

スクリーンショット 2022-12-17 16 20 26

Example Swagger/OpenAPI definition:

{
    "openapi": "3.0.1",
    "servers": [
        {
            "url": "http://localhost:3200",
            "description": "Generated server url"
        }
    ],
    "paths": {
        "/cookie": {
            "get": {
                "tags": [
                    "cookie-controller"
                ],
                "operationId": "index_6",
                "parameters": [
                    {
                        "name": "aa",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "test",
                        "in": "cookie",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "404": {
                        "description": "example response"
                    },
                    "200": {
                        "description": "example response",
                        "content": {
                            "*/*": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        },
    }
}

Swagger-UI configuration options:

SwaggerUI({
  // your config options here
})

Default value not specified.

Describe the bug you're encountering

I enter a value in the cookie parameter and execute it, but it is not set in the Request Header.

To reproduce...

Same as above.

Expected behavior

I want the value to be set in the cookie in the Request header.

Screenshots

Same as above

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 request in Swagger UI with the supplied OpenAPI 3.0.1 definition and cookie parameter. Inspect the generated request and Request Headers to determine where the cookie value is lost. Done means executing the operation sends the entered value as a cookie in the request.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.