Calling Minimal API with IFormFile gets "Invalid anti-forgery token" #49929
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
✔️ Resolution: By Design
Resolved because the behavior in this issue is the intended design.
Status: Resolved
Is there an existing issue for this?
Describe the bug
This is .NET 8 Preview 7.
I have a Minimal API endpoint that takes a
IFormFile
as an argument. When the endpoint is called ASP.NET core complains with:Microsoft.AspNetCore.Http.BadHttpRequestException: Invalid anti-forgery token found when reading parameter "IFormFile file" from the request body as form.
If I call the endpoint from Swagger, I get the following exception in the console:
Expected Behavior
The API endpoint should just work.
Steps To Reproduce
The code for the endpoint:
Exceptions (if any)
No response
.NET Version
8.0.100-preview.7.23376.3
Anything else?
No response
The text was updated successfully, but these errors were encountered: