GenerateAspNetCoreClient icon indicating copy to clipboard operation
GenerateAspNetCoreClient copied to clipboard

Parameter generation error when model contains IFormFile

Open MarkJosephCabana opened this issue 2 years ago • 1 comments

The generated method contains an extra Multipartitem param when you add an IFormFile property as the 1st property. to replicate: namespace TestWebApi.Models { public class SomeQueryModel { public IFormFile File { get; set; } //must be the first prop public string Param1 { get; set; } public Guid? Param2 { get; set; } public int Param3 { get; set; } } }

then the code generated will be something like: [Multipart] [Post("/WeatherForecast/form")] Task WithFormParam(MultipartItem formParam = null, [Body(BodySerializationMethod.UrlEncoded)] SomeQueryModel formParam = null);

MarkJosephCabana avatar Nov 22 '22 03:11 MarkJosephCabana

What is the expected behavior? You need MultipartItem parameter to be able to pass file which Refit will understand. I doubt that Refit knows what to do with IFormFile.

Dreamescaper avatar Nov 22 '22 10:11 Dreamescaper