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

Ensure request body availability after openapi3 filter validation #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ikattey
Copy link

@ikattey ikattey commented Jul 25, 2024

This PR addresses an issue originally reported in the kin-openapi project (getkin/kin-openapi#743), where the request body was not available to handlers after being processed by the openapi3 filter.

This change:

  • makes a copy of the original request body before validation.
  • resets it afterwards using the copy, ensuring it's available for subsequent processing.

Existing tests cover this functionality but don't reproduce the issue. It's also not clear why the issue occurs, as openapi3filter.ValidateRequest() appears to reset the request body.

In any case, this approach makes request handling more robust – regardless of how the openapi3 filter or any future updates to it might handle the body.

@ikattey ikattey requested a review from a team as a code owner July 25, 2024 09:31
@jamietanna
Copy link
Member

Thanks - will try and have a look soon, and then make sure that this is consistent across all middlewares :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants