Is there an existing issue for this?
Describe the bug
If I have:
public static async Task SetCurrentUserProfileImageAsync(IFormFile? image, [other params])
{
}
But the client sends the request without a body, it still throws the following even thought the IFormFile is nullable:
Microsoft.AspNetCore.Http.BadHttpRequestException: 'Unexpected request without body, failed to bind parameter "IFormFile image" from the request body as form.'
Expected Behavior
If the IFormFile is optional then it should not throw. In the example above, a null IFormFile means the API calll wants to clear the profile image so a body is not required.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
10
Anything else?
No response
Is there an existing issue for this?
Describe the bug
If I have:
But the client sends the request without a body, it still throws the following even thought the
IFormFileis nullable:Expected Behavior
If the
IFormFileis optional then it should not throw. In the example above, a nullIFormFilemeans the API calll wants to clear the profile image so a body is not required.Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
10
Anything else?
No response