diff --git a/src/WebSocketProtocol.cpp b/src/WebSocketProtocol.cpp index 6f90fe4c..1a74ae1a 100644 --- a/src/WebSocketProtocol.cpp +++ b/src/WebSocketProtocol.cpp @@ -238,9 +238,9 @@ WebSocketProtocol::ProcessResult WebSocketProtocol::ProcessMessage(SessionPtr se std::vector WebSocketProtocol::GetRequestList() { - std::vector ret; + RequestHandler requestHandler; - return ret; + return requestHandler.GetRequestList(); } std::vector WebSocketProtocol::GetEventList() diff --git a/src/requesthandler/RequestHandler.cpp b/src/requesthandler/RequestHandler.cpp index fedbd20f..ac28cce0 100644 --- a/src/requesthandler/RequestHandler.cpp +++ b/src/requesthandler/RequestHandler.cpp @@ -25,4 +25,14 @@ RequestResult RequestHandler::ProcessRequest(const Request& request) } return std::bind(handler, this, std::placeholders::_1)(request); -} \ No newline at end of file +} + +std::vector RequestHandler::GetRequestList() +{ + std::vector ret; + for (auto const& [key, val] : _handlerMap) { + ret.push_back(key); + } + + return ret; +} diff --git a/src/requesthandler/RequestHandler.h b/src/requesthandler/RequestHandler.h index 53b60f41..c0e5c521 100644 --- a/src/requesthandler/RequestHandler.h +++ b/src/requesthandler/RequestHandler.h @@ -12,6 +12,7 @@ typedef RequestResult(RequestHandler::*RequestMethodHandler)(const Request&); class RequestHandler { public: RequestResult ProcessRequest(const Request& request); + std::vector GetRequestList(); private: RequestResult GetVersion(const Request&);