| 74 | |
| 75 | private: |
| 76 | bool HandleRequest(const WaitGroup::Ptr&, const HttpApiRequest& request, HttpApiResponse& response, |
| 77 | boost::asio::yield_context& yc) override |
| 78 | { |
| 79 | response.result(boost::beast::http::status::ok); |
| 80 | |
| 81 | auto path = request.Url()->GetPath(); |
| 82 | |
| 83 | if (path.size() == 3) { |
| 84 | if (auto it = testFns.find(path[2].GetData()); it != testFns.end()) { |
| 85 | it->second(response, yc); |
| 86 | return true; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | response.body() << "test"; |
| 91 | return true; |
| 92 | } |
| 93 | |
| 94 | static inline std::unordered_map<std::string, TestFn> testFns; |
| 95 | }; |