mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-01-21 12:17:01 +00:00
return 204 when no data
This commit is contained in:
parent
e757086465
commit
210bc48149
@ -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)) {
|
if (mg_match(http_msg->uri, mg_str((root_path + "players").c_str()), NULL)) {
|
||||||
const json data = Game::playerContainer;
|
const json data = Game::playerContainer;
|
||||||
|
|
||||||
reply.status = 200;
|
reply.status = data.empty() ? 204 : 200;
|
||||||
reply.message = data.empty() ? "{\"error\":\"No Players Online\"}" : data.dump();
|
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)) {
|
} else if (mg_match(http_msg->uri, mg_str((root_path + "teams").c_str()), NULL)) {
|
||||||
// Get Teams
|
// Get Teams
|
||||||
const json data = Game::playerContainer.GetTeamComtainer();
|
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();
|
reply.message = data.empty() ? "{\"error\":\"No Teams Online\"}" : data.dump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user