I have backend endpoint Task<ActionResult> Post(IFormFile csvFile)
and I need to call this endpoint from HttpClient. Currently I am getting Unsupported media type error
.
Here is my code:
var filePath = Path.Combine("IntegrationTests", "file.csv");
var gg = File.ReadAllBytes(filePath);
var byteArrayContent = new ByteArrayContent(gg);
var postResponse = await _client.PostAsync("offers", new MultipartFormDataContent
{
{byteArrayContent }
});