【发布时间】:2021-03-28 17:59:35
【问题描述】:
实际上,在我的 Api 服务中,我有一个方法控制器,例如:
[Produces("application/json")]
[ApiController]
[Route("api/v1/[controller]")]
public class LoginController: Controller
{
public LoginController(IConfiguration config)
{
...
}
[Route("authentication"),HttpPost]
public async Task<IActionResult> Authentication(LogRequest request)
{
...
}
}
我的配置:
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "tresfilos.users.service",
"Port": 7002
}
],
"UpstreamPathTemplate": "/api/{version}/user/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ]
},
],
"GlobalConfiguration": {
"BaseUrl": "https://localhost:7001"
}
我在邮递员中消费,例如: http://localhost:7000/api/v1/user/Login/authentication
而且我不知道我对豹猫配置文件的定义是否适合 POST 方法。
【问题讨论】:
标签: asp.net-core post routes ocelot