-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Optional [FromBody] Model Binding is not working #29570
Copy link
Copy link
Closed
Labels
Priority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutfeature-model-bindingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labelstriage-focusAdd this label to flag the issue for focus at triageAdd this label to flag the issue for focus at triage
Milestone
Metadata
Metadata
Assignees
Labels
Priority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutfeature-model-bindingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labelstriage-focusAdd this label to flag the issue for focus at triageAdd this label to flag the issue for focus at triage
Type
Fields
Give feedbackNo fields configured for issues without a type.
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.