Skip to content

Return unsuccessful when trying to read form and request does not have body #53680

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

Merged

Conversation

balazsmeszegeto
Copy link
Contributor

@balazsmeszegeto balazsmeszegeto commented Jan 28, 2024

Return unsuccessful when trying to read form and request does not have body. Fixes #53630

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Description

TryReadFormAsync returns unsuccessful, if IHttpRequestBodyDetectionFeature.CanHaveBody is false, while attempting to read form. Previously, when IHttpRequestBodyDetectionFeature.CanHaveBody was false, returned successful, which resulted that request without body and content type would result unwanted reading attempt of the (non-existing form) and throwing/returning 500 status

Fixes #53630

@ghost ghost added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member labels Jan 28, 2024
@ghost
Copy link

ghost commented Jan 28, 2024

Thanks for your PR, @balazsmeszegeto. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@balazsmeszegeto
Copy link
Contributor Author

@dotnet-policy-service agree

@captainsafia captainsafia changed the title Return unsuccessful when trying to read form and request does not have body. Fixes #53630 Return unsuccessful when trying to read form and request does not have body Jan 29, 2024
@captainsafia captainsafia enabled auto-merge (squash) January 29, 2024 23:26
@balazsmeszegeto
Copy link
Contributor Author

I'm a bit uncertain, do you need anything else from me? I don't really understand why components-e2e is failing (doesn't seem to be related)

@adityamandaleeka adityamandaleeka merged commit 7775891 into dotnet:main Jan 31, 2024
@ghost ghost added this to the 9.0-preview1 milestone Jan 31, 2024
@adityamandaleeka
Copy link
Member

Thanks @balazsmeszegeto! Yea, the components failure (and the markdown lint failure) were unrelated to your changes :).

@balazsmeszegeto balazsmeszegeto deleted the fix-formfile-throws-without-body branch January 31, 2024 08:08
@wtgodbe wtgodbe modified the milestones: 9.0-preview1, 9.0-preview2 Jan 31, 2024
@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minimal API with IFormFile throws when request body is missing and Content-Type header is missing or empty
4 participants