-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Optional [FromBody] Model Binding is not working #29570
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
Comments
After debugging this code, I'm able to work around it by introducing a custom InputFormatter. It overrides the following methods from InputFormatter.cs:
|
Thanks for contacting us. |
Thanks for contacting us. We're moving this issue to the |
Related #39754 |
Describe the bug
I am trying to use optional [FromBody] model binding, for example,
MVC options are configured as below to allow empty input in body:
However, when requesting the API with an empty request body, I got the Error 415,
To Reproduce
I'm using the sample code from https://github.com/pranavkm/OptionalBodyBinding. This is a sample code given from #6878.
Besides, I also targeted the project to netcore5. The bug still repos.
Exceptions (if any)
Further technical details
dotnet --info
:From console.
The text was updated successfully, but these errors were encountered: