Skip to content

Warn when more than one [FromBody] #68

Open
@JohanLarsson

Description

@JohanLarsson
// Don't do this. All of the following actions result in an exception.
[HttpPost]
public IActionResult Action1(Product product, 
                             Order order) => null;

[HttpPost]
public IActionResult Action2(Product product, 
                             [FromBody] Order order) => null;

[HttpPost]
public IActionResult Action3([FromBody] Product product, 
                             [FromBody] Order order) => null;

https://docs.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-2.2#binding-source-parameter-inference

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions