当我尝试发送请求" http://localhost:1234/api/case/create?signature=123456" 来自Postman(谷歌扩展)使用" form-data"在身体要求中,我收到错误:
"消息":"请求实体的媒体类型' multipart / form-data'此资源不支持。", " ExceptionMessage":"没有MediaTypeFormatter可用于读取' Case'来自媒体类型的内容' multipart / form-data'。", " ExceptionType":" System.Net.Http.UnsupportedMediaTypeException"。
我的行动:
[Route("create")]
public object Create([FromBody]Case newCase, string signature)
{
var member = _memberService.GetUserByToken(signature);
if (member != null)
{
var caseId = _caseService.Add(newCase, member);
return Ok(new { caseId });
}
return NotFound();
}