From 210bc481496a5af03e38851b1948ce56f4ac174b Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Thu, 2 Jan 2025 23:11:06 -0600 Subject: [PATCH] return 204 when no data --- dChatServer/ChatWebAPI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dChatServer/ChatWebAPI.cpp b/dChatServer/ChatWebAPI.cpp index cce1cecc..d720a9cd 100644 --- a/dChatServer/ChatWebAPI.cpp +++ b/dChatServer/ChatWebAPI.cpp @@ -74,13 +74,13 @@ void HandleRequests(mg_connection* connection, int request, void* request_data) if (mg_match(http_msg->uri, mg_str((root_path + "players").c_str()), NULL)) { const json data = Game::playerContainer; - reply.status = 200; + reply.status = data.empty() ? 204 : 200; reply.message = data.empty() ? "{\"error\":\"No Players Online\"}" : data.dump(); } else if (mg_match(http_msg->uri, mg_str((root_path + "teams").c_str()), NULL)) { // Get Teams const json data = Game::playerContainer.GetTeamComtainer(); - reply.status = 200; + reply.status = data.empty() ? 204 : 200; reply.message = data.empty() ? "{\"error\":\"No Teams Online\"}" : data.dump(); } }