我有一个后端终点Task<ActionResult> Post(IFormFile csvFile)
,我需要从HttpClient调用这个终点。目前我遇到了不支持的媒体类型错误
。
下面是我的代码:
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 }
});