GenerateAspNetCoreClient
GenerateAspNetCoreClient copied to clipboard
Parameter generation error when model contains IFormFile
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);
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.