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

Discovery handler does not handle accept header correctly #1441

Closed
msteur opened this issue Nov 22, 2021 · 0 comments · Fixed by #1449
Closed

Discovery handler does not handle accept header correctly #1441

msteur opened this issue Nov 22, 2021 · 0 comments · Fixed by #1449

Comments

@msteur
Copy link

msteur commented Nov 22, 2021

Description of Problem / Feature Request

I'm trying to load /openapi/v1 in swagger ui, but this fails with an error message of endpoint only allows application/json or application/vnd.oai.openapi+json.

Swagger uses a GET request with an Accept header of application/json, */* which should be valid.
Manually trying it with application/json or */* works.
Looking at the code it seems that it tries to match the full header instead of treating it as a comma separated list.

Expected Outcome

It should return the openapi spec with a status code of 200

Actual Outcome

An error message of endpoint only allows application/json or application/vnd.oai.openapi+json with a status code of 400.

Environment

  • Clair version/image: 4.3.5
  • Clair client name/version: n/a
  • Host OS: n/a
  • Kernel (e.g. uname -a): n/a
  • Kubernetes version (use kubectl version): n/a
  • Network/Firewall setup: n/a
hdonnay added a commit to hdonnay/clair that referenced this issue Dec 1, 2021
This fixes the handling of the "accept" header to process lists and "q"
parameters properly, and moves it to a common helper function.

Closes: quay#1441
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
@hdonnay hdonnay closed this as completed in d3cbb5a Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant