RequestHander: Add GetRequestList()

This commit is contained in:
tt2468 2021-05-13 17:46:05 -07:00
parent 11d28d17f1
commit 680b5c470e
3 changed files with 14 additions and 3 deletions

View File

@ -238,9 +238,9 @@ WebSocketProtocol::ProcessResult WebSocketProtocol::ProcessMessage(SessionPtr se
std::vector<std::string> WebSocketProtocol::GetRequestList()
{
std::vector<std::string> ret;
RequestHandler requestHandler;
return ret;
return requestHandler.GetRequestList();
}
std::vector<std::string> WebSocketProtocol::GetEventList()

View File

@ -25,4 +25,14 @@ RequestResult RequestHandler::ProcessRequest(const Request& request)
}
return std::bind(handler, this, std::placeholders::_1)(request);
}
}
std::vector<std::string> RequestHandler::GetRequestList()
{
std::vector<std::string> ret;
for (auto const& [key, val] : _handlerMap) {
ret.push_back(key);
}
return ret;
}

View File

@ -12,6 +12,7 @@ typedef RequestResult(RequestHandler::*RequestMethodHandler)(const Request&);
class RequestHandler {
public:
RequestResult ProcessRequest(const Request& request);
std::vector<std::string> GetRequestList();
private:
RequestResult GetVersion(const Request&);