From 1f225a0e14cea672f5d1ac00c26101e76ebbca9b Mon Sep 17 00:00:00 2001 From: 3Mydlo3 Date: Sat, 14 Sep 2024 14:29:11 +0200 Subject: [PATCH] Fix 400 returned when server is not found (#98) --- .../Api/Servers/ServersController.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ArmaForces.ArmaServerManager/Api/Servers/ServersController.cs b/ArmaForces.ArmaServerManager/Api/Servers/ServersController.cs index 4bc829b..57456aa 100644 --- a/ArmaForces.ArmaServerManager/Api/Servers/ServersController.cs +++ b/ArmaForces.ArmaServerManager/Api/Servers/ServersController.cs @@ -118,7 +118,7 @@ public async Task SetHeadlessClients(int port, HeadlessSetRequest return result.Match( onSuccess: NoContent, - onFailure: error => (IActionResult) BadRequest(error)); + onFailure: error => (IActionResult) NotFound(error)); } /// Restart Server @@ -127,6 +127,7 @@ public async Task SetHeadlessClients(int port, HeadlessSetRequest /// Additional details. [HttpPost("{port:int}/restart", Name = nameof(RestartServer))] [ProducesResponseType(typeof(int), StatusCodes.Status202Accepted)] + [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(string), StatusCodesExtended.Status425TooEarly)] [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)] [ApiKey] @@ -134,7 +135,7 @@ public IActionResult RestartServer(int port, ServerRestartRequestDto serverResta { var serverGetResult = _serverQueryLogic.GetServer(port); - if (serverGetResult.IsFailure) return BadRequest("Server is not running and cannot be restarted."); + if (serverGetResult.IsFailure) return NotFound("Server is not running and cannot be restarted."); var server = serverGetResult.Value;