diff options
Diffstat (limited to 'zenserver/testing')
| -rw-r--r-- | zenserver/testing/httptest.cpp | 26 | ||||
| -rw-r--r-- | zenserver/testing/launch.cpp | 4 |
2 files changed, 13 insertions, 17 deletions
diff --git a/zenserver/testing/httptest.cpp b/zenserver/testing/httptest.cpp index 924546762..230d5d6c5 100644 --- a/zenserver/testing/httptest.cpp +++ b/zenserver/testing/httptest.cpp @@ -8,51 +8,49 @@ namespace zen { -using namespace fmt::literals; - HttpTestingService::HttpTestingService() { m_Router.RegisterRoute( "hello", - [this](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponse(HttpResponseCode::OK); }, + [](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponse(HttpResponseCode::OK); }, HttpVerb::kGet); m_Router.RegisterRoute( "hello_slow", - [this](HttpRouterRequest& Req) { - Req.ServerRequest().WriteResponseAsync([this](HttpServerRequest& Request) { + [](HttpRouterRequest& Req) { + Req.ServerRequest().WriteResponseAsync([](HttpServerRequest& Request) { Stopwatch Timer; Sleep(1000); Request.WriteResponse(HttpResponseCode::OK, HttpContentType::kText, - "hello, took me {}"_format(NiceTimeSpanMs(Timer.GetElapsedTimeMs()))); + fmt::format("hello, took me {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs()))); }); }, HttpVerb::kGet); m_Router.RegisterRoute( "hello_veryslow", - [this](HttpRouterRequest& Req) { - Req.ServerRequest().WriteResponseAsync([this](HttpServerRequest& Request) { + [](HttpRouterRequest& Req) { + Req.ServerRequest().WriteResponseAsync([](HttpServerRequest& Request) { Stopwatch Timer; Sleep(60000); Request.WriteResponse(HttpResponseCode::OK, HttpContentType::kText, - "hello, took me {}"_format(NiceTimeSpanMs(Timer.GetElapsedTimeMs()))); + fmt::format("hello, took me {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs()))); }); }, HttpVerb::kGet); m_Router.RegisterRoute( "hello_throw", - [this](HttpRouterRequest& Req) { - Req.ServerRequest().WriteResponseAsync([this](HttpServerRequest&) { throw std::runtime_error("intentional error"); }); + [](HttpRouterRequest& Req) { + Req.ServerRequest().WriteResponseAsync([](HttpServerRequest&) { throw std::runtime_error("intentional error"); }); }, HttpVerb::kGet); m_Router.RegisterRoute( "hello_noresponse", - [this](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponseAsync([this](HttpServerRequest&) {}); }, + [](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponseAsync([](HttpServerRequest&) {}); }, HttpVerb::kGet); m_Router.RegisterRoute( @@ -84,7 +82,7 @@ HttpTestingService::HttpTestingService() m_Router.RegisterRoute( "echo", - [this](HttpRouterRequest& Req) { + [](HttpRouterRequest& Req) { IoBuffer Body = Req.ServerRequest().ReadPayload(); Req.ServerRequest().WriteResponse(HttpResponseCode::OK, HttpContentType::kBinary, Body); }, @@ -92,7 +90,7 @@ HttpTestingService::HttpTestingService() m_Router.RegisterRoute( "package", - [this](HttpRouterRequest& Req) { + [](HttpRouterRequest& Req) { CbPackage Pkg = Req.ServerRequest().ReadPayloadPackage(); Req.ServerRequest().WriteResponse(HttpResponseCode::OK, Pkg); }, diff --git a/zenserver/testing/launch.cpp b/zenserver/testing/launch.cpp index 706594b10..f315ec1b4 100644 --- a/zenserver/testing/launch.cpp +++ b/zenserver/testing/launch.cpp @@ -55,8 +55,6 @@ BasicJob::~BasicJob() bool BasicJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLine) { - using namespace fmt::literals; - STARTUPINFOEX StartupInfo = {sizeof(STARTUPINFOEX)}; PROCESS_INFORMATION ProcessInfo{}; @@ -76,7 +74,7 @@ BasicJob::SpawnJob(std::filesystem::path ExePath, std::wstring CommandLine) if (!Created) { - throw std::system_error(::GetLastError(), std::system_category(), "Failed to create process '{}'"_format(ExePath).c_str()); + throw std::system_error(::GetLastError(), std::system_category(), fmt::format("Failed to create process '{}'", ExePath).c_str()); } m_ProcessId = ProcessInfo.dwProcessId; |