mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Core: Added all well known http status codes (#195)
This commit is contained in:
parent
7b38e463df
commit
fd1ea9a945
6 changed files with 98 additions and 7 deletions
|
|
@ -9,7 +9,7 @@ void ProcessHttpRequest(TcpSocket& client)
|
|||
HttpHeader header;
|
||||
if(!header.Read(client)) {
|
||||
Cerr() << "Failed to read HttpHeader.\n";
|
||||
HttpResponse(client, false, 400, "Invalid request");
|
||||
HttpResponse(client, false, HttpStatus::BAD_REQUEST);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -21,12 +21,15 @@ void ProcessHttpRequest(TcpSocket& client)
|
|||
<< "Indonesia"
|
||||
<< "Brazil"
|
||||
<< "France";
|
||||
|
||||
HttpResponse(client, false, 200, "OK", "application/json", ja.ToString());
|
||||
|
||||
auto code = HttpStatus::OK;
|
||||
HttpResponse(client, false, code, HttpStatus::ToString(code), "application/json",
|
||||
ja.ToString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HttpResponse(client, false, 404, "Not found");
|
||||
|
||||
HttpResponse(client, false, HttpStatus::NOT_FOUND);
|
||||
}
|
||||
|
||||
void RunServerLoop(TcpSocket& server)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue