Запрос POST отлично работает локально без Kubernetes , используя Visual Studio.
Вот ответ на запрос GET от PowerShell в кластере Kubernetes:

Но когда я пытаюсь запустить POST-запрос, он не работает, какая-то ошибка валидатора json с использованием Curl

Здесь это мой запрос кода с использованием RestSharp
var jsonContent = JsonSerializer.Serialize(plat);
var request = new RestRequest(_configuration["CommandService"], Method.Post)
.AddHeader("Content-Type", "application/json")
.AddJsonBody(jsonContent); // Pass the serialized JSON here
// Execute the request asynchronously
var response = await _restClient.ExecuteAsync(request);
И контроллер, слушающий запрос
public class PlatformReadDto
{
public int Id { get; set; }
public string Name { get; set; }
public string Publisher { get; set; }
public string Cost { get; set; }
}
[HttpPost]
[Route("TestInboundConnection")]
public ActionResult TestInboundConnection([FromBody] PlatformReadDto platform)
{
// Log the received platform data
Console.WriteLine($"Received Platform: {platform.Name}, Publisher: {platform.Publisher}, Cost: {platform.Cost}");
// Return a response with the received data
return Ok(new { message = "Inbound test from Platform Controller", platform });
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... ot-working
Мобильная версия