我具有以下控制器和操作:
[ApiController, ApiVersion("1.0", Deprecated = false), Route("v{version:version}")]
public class PostController : ControllerBase {
[HttpGet("users/{userId}/posts")]
public async Task<IActionResult> GetByUserId(GetModel model) {
}
[HttpPost("users/{userId}/posts")]
public async Task<IActionResult> CreateByUserId(CreateModel model) {
}
}
我尝试使用Angular和Insomnia访问这两个动作...
我能够访问CreateByUserId [POST],但在GetByUserId [GET]上却收到错误消息:
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.13",
"title": "Unsupported Media Type",
"status": 415,
"traceId": "0HLMF7BM7U94L:00000001"
}
我想念什么?该动作是一个简单的Get动作。