0

I'm trying to write a http post using minimal API in C# NetCore7, that recieves IFormFile file.

MinimalAPI:

 var group = app.MapGroup("Payment").WithTags("Payment").WithOpenApi();
group.MapPost("htmlToPdf", async (IFormFile file) =>
    {
       ....
       ...       
}).Accepts<IFormFile>("multipart/form-data");

When I upload the file by using swaggerUI, the file is null:

SwaggerUI

What am I doing wrong?

ayala
  • 331
  • 1
  • 9
  • Was not able to reproduce. Do you have a [mre]? Can you please show how do you post the file? – Guru Stron Apr 27 '23 at 19:13
  • Thanks for your comment. I post the file using SwaggerUI like in the Sceenshot i added to the question. – ayala Apr 29 '23 at 19:53

1 Answers1

0

The problem was in the following line:

var group = app.MapGroup("Payment").WithTags("Payment").WithOpenApi();

When i removed the following WithOpenAPi() extension, The uploading file is work properlly!

ayala
  • 331
  • 1
  • 9