I have an enpoint that I send request via Postman form-data. Request has 2 keys.
message : string
file: File
this works ok. So, I want to send the same request in C# code. In c# I just need to choose file from local, somehow convert it to proper format, assign it to file
property in request Model, I mean I can not change the logic how request is sent. I must not write additional logic to HttpRequest or MultipartFormDataContent etc (I can not even see this part how it is sent). Just need to add Model to this request body.
I have model RequestModel
public class RequestModel
{
[JsonProperty("message")]
public string Message {get; set; }
[JsonProperty("file")]
public whateverType File {get; set; }
}
message part works, so I need to assign local file to File property. how can I do that. I tried almost everything but it does not work. Thanks.