fix stop server request serialization

This commit is contained in:
zznty
2022-07-21 22:03:20 +07:00
parent bc4546410e
commit 10dfe63b9c
2 changed files with 2 additions and 2 deletions

View File

@@ -1,3 +1,3 @@
namespace TorchRemote.Models.Requests; namespace TorchRemote.Models.Requests;
public record StopServerRequest(bool Save = true); public record StopServerRequest(bool Save);

View File

@@ -34,7 +34,7 @@ public class ServerController : WebApiController
} }
[Route(HttpVerbs.Post, $"{RootPath}/stop")] [Route(HttpVerbs.Post, $"{RootPath}/stop")]
public async Task Stop(StopServerRequest request) public async Task Stop([JsonData] StopServerRequest request)
{ {
if (!Statics.Torch.IsRunning) if (!Statics.Torch.IsRunning)
throw HttpException.BadRequest($"Server can't stop in state {Statics.Torch.State}", Statics.Torch.State); throw HttpException.BadRequest($"Server can't stop in state {Statics.Torch.State}", Statics.Torch.State);