Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header Not Removed After Deletion #4749

Closed
shockey opened this issue Jul 19, 2018 · 1 comment
Closed

Header Not Removed After Deletion #4749

shockey opened this issue Jul 19, 2018 · 1 comment

Comments

@shockey
Copy link
Contributor

shockey commented Jul 19, 2018

From @5aledBos on July 19, 2018 18:25

Hi,

I encountered a bug while handling headers.

Here an example of a GET method on the endpoint /path/:

paths:
  /path/:
    get:
      tags:
        - TestPath
      parameters:
        - in: header
          name: header_field
          required: false
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                type: object
        '404':
          description: NotFound
          content:
            application/json:
              schema:
                type: object
        '500':
          description: ServerError
          content:
            application/json:
              schema:
                type: object

When i try a GET without the header header_field for the first time the request is passed with the right parameters
the curl request is the following:

curl -X GET "http://localhost:8000/api/v1/path/" -H "accept: application/json"

Now I try a second time with a value of header_field

curl -X GET "http://localhost:8000/api/v1/path/" -H "accept: application/json" -H "header_field: f94dcbff-ca94-4fe3-9c4c-731aae66790d"

Now the problem is when I try a request for the 3rd time whithout the header_field

curl -X GET "http://localhost:8000/api/v1/path/" -H "accept: application/json" -H "header_field: "

as you can see in the curl request, the -H "header_field" was not removed from the request and gets a "" instead of undifined value. That creates a problem in my case because "" is not considered as a valid uuid.

I think it would be convenient to check the headers in the execute function (swagger-editor/dist/swagger-editor-bundle.js) and to set the fields with an empty string to undifined

I tryed adding this line after declaring the variables and it works as expected:

for (var param in d){if (d[param]==""){d[param] = undefined}}

Configuration used

  • OS: [Debian9]
  • Browser: [chrome]
  • Method of installation: [npm]
  • Swagger-Editor version: [3.6.3]
  • Swagger/OpenAPI version: [Swagger 3.0]

Copied from original issue: swagger-api/swagger-editor#1843

@hkosova
Copy link
Contributor

hkosova commented Jan 11, 2022

Looks like this has been fixed. The steps work as expected in Swagger UI 4.1.3 and Swagger Editor 4.0.4.

@hkosova hkosova closed this as completed Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants