transfrom short switch statements into readable if statements
This commit is contained in:
parent
03f4aaa2d6
commit
5adfe2d46b
@ -92,25 +92,27 @@ Reply Reply::StockReply(Reply::status_type status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string Reply::ToString(Reply::status_type status) {
|
std::string Reply::ToString(Reply::status_type status) {
|
||||||
switch (status) {
|
if (Reply::ok == status)
|
||||||
case Reply::ok:
|
{
|
||||||
return okHTML;
|
return okHTML;
|
||||||
case Reply::badRequest:
|
|
||||||
return badRequestHTML;
|
|
||||||
default:
|
|
||||||
return internalServerErrorHTML;
|
|
||||||
}
|
}
|
||||||
|
if (Reply::badRequest == status)
|
||||||
|
{
|
||||||
|
return badRequestHTML;
|
||||||
|
}
|
||||||
|
return internalServerErrorHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::const_buffer Reply::ToBuffer(Reply::status_type status) {
|
boost::asio::const_buffer Reply::ToBuffer(Reply::status_type status) {
|
||||||
switch (status) {
|
if (Reply::ok == status)
|
||||||
case Reply::ok:
|
{
|
||||||
return boost::asio::buffer(okString);
|
return boost::asio::buffer(okString);
|
||||||
case Reply::internalServerError:
|
|
||||||
return boost::asio::buffer(internalServerErrorString);
|
|
||||||
default:
|
|
||||||
return boost::asio::buffer(badRequestString);
|
|
||||||
}
|
}
|
||||||
|
if (Reply::internalServerError == status)
|
||||||
|
{
|
||||||
|
return boost::asio::buffer(internalServerErrorString);
|
||||||
|
}
|
||||||
|
return boost::asio::buffer(badRequestString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user