diff --git a/src/Guestbooky/Guestbooky.API/Controllers/MessageController.cs b/src/Guestbooky/Guestbooky.API/Controllers/MessageController.cs index 832d390..f9b1afa 100644 --- a/src/Guestbooky/Guestbooky.API/Controllers/MessageController.cs +++ b/src/Guestbooky/Guestbooky.API/Controllers/MessageController.cs @@ -23,7 +23,7 @@ public class MessageController : ControllerBase } [HttpPost] - [ProducesResponseType(StatusCodes.Status201Created)] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status403Forbidden)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] public async Task Insert([FromBody] InsertMessageRequestDto message, CancellationToken token) diff --git a/src/input-example/example.html b/src/input-example/example.html index 69eced1..0f62e4d 100644 --- a/src/input-example/example.html +++ b/src/input-example/example.html @@ -141,13 +141,12 @@ document body: JSON.stringify(data), }); - const result = await response.json(); - - if (response.ok) { + if (response.status >= 200 && response.status <= 299) { alert("Note added successfully!"); this.reset(); // Clear the form fields } else { - alert(result.errorMessage); + const problem = await response.json(); + alert(problem); } });