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

pandaproxy: Improve header validation #3664

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

BenPope
Copy link
Member

@BenPope BenPope commented Jan 31, 2022

Cover letter

Ensure consistency between request validation and Swagger UI command generation

  • Requests without a body do not require Content-Type validation
  • Swagger: Remove consumes for empty body requests
  • Swagger: Ensure produces for all endpoints to prevent SwaggerUI generating application/json

Swagger documented on SwaggerHub

Signed-off-by: Ben Pope ben@vectorized.io

Release notes

Improvements

  • Pandaproxy REST: Improve header validation and Swagger API

@BenPope BenPope added kind/bug Something isn't working area/pandaproxy REST interface for Kafka API labels Jan 31, 2022
@BenPope BenPope self-assigned this Jan 31, 2022
@CLAassistant
Copy link

CLAassistant commented Jan 31, 2022

CLA assistant check
All committers have signed the CLA.

@NyaliaLui
Copy link
Contributor

Looks like something is returning JSON as a valid content-type and breaking one of the tests.

Ensure consistency between request validation and Swagger UI
command generation

* Requests without a body do not require `Content-Type` validation
* Swagger: Remove 'consumes' for empty body requests
* Swagger: Ensure 'produces' for all endpoints to prevent SwaggerUI
  generating `application/json`

Signed-off-by: Ben Pope <ben@vectorized.io>
@BenPope
Copy link
Member Author

BenPope commented Feb 1, 2022

Looks like something is returning JSON as a valid content-type and breaking one of the tests.

The test was checking that the content type is specifically rejected. I see no need.

@dotnwat
Copy link
Member

dotnwat commented Feb 1, 2022

Requests without a body do not require Content-Type validation

Is it really about the empty body or is it more about GET vs {POST,PUT}?

@BenPope
Copy link
Member Author

BenPope commented Feb 1, 2022

Requests without a body do not require Content-Type validation

Is it really about the empty body or is it more about GET vs {POST,PUT}?

There are GET requests in the API which do have a body.

I imagine it's possible that v1 had a different format to v2 or maybe v3 is different (although they pretty much dropped Accept and Content-Type for v3).

It may even be possible to change the query parameters based on the Content-Type, although that would make it tricky to build a Swagger description, and pretty much upset every user and implementer.

@BenPope BenPope merged commit b978b47 into redpanda-data:dev Feb 2, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/pandaproxy REST interface for Kafka API area/redpanda kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants