0

Actually in my Api service i have a method controller like:

[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)
  {
    ...
  }
}

My configuration:

 "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"
 }

I consume in postman like: http://localhost:7000/api/v1/user/Login/authentication

And i dont know if my definition on configuration file for ocelot is right for POST method.

Dr oscar
  • 359
  • 1
  • 4
  • 16

1 Answers1

0

I define now like:

"Routes": [
  {
   "DownstreamPathTemplate": "/api/{version}/{everything}",
   "DownstreamScheme": "http",
   "DownstreamHostAndPorts": [
   {
     "Host": "tresfilos.users.service",
     "Port": 7002
   }
 ],
  "UpstreamPathTemplate": "/api/{version}/User/{everything}"
 },
],
 "GlobalConfiguration": {
 "BaseUrl":  "https://localhost:7001"
}

Change ReRoutes to Routes because i use ocelot 16.0.1 And in postman i send the data in Body like json and not like paramaters.

Dr oscar
  • 359
  • 1
  • 4
  • 16