Skip to content

Properly support different FromBody.AllowEmpty settings  #34567

@captainsafia

Description

@captainsafia

The FromBody attribute currently accepts a boolean allowEmpty value that allows the developer to determine whether or not the route will accept an empty body as part of the request.

The attribute currently assumes that both EmptyBodyBehavior.Default and EmptyBodyBehavior.Disallow map to allowEmpty = false which is problematic when we want to discern scenarios where a developer explicitly set the allowEmpty parameter vs scenarios where we are using the implied value.

We'll need to update the codepath to discern when a user set the AllowEmpty attribute to support overriding the optionality configuration that was inferred from the code.

See #34505 (comment) for more info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority:3Work that is nice to havearea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routing

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions