From 822b0b1cb3868fdfc2b7159cdbf11c3df776c9dd Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Sun, 12 Sep 2021 11:51:29 +0200 Subject: HttpResponse enum -> HttpResponseCode Also removed initial CbPackage API HttpServer changes as I have decided to take a different approach --- zenhttp/httpuws.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'zenhttp/httpuws.cpp') diff --git a/zenhttp/httpuws.cpp b/zenhttp/httpuws.cpp index 2fb3734e8..992809b17 100644 --- a/zenhttp/httpuws.cpp +++ b/zenhttp/httpuws.cpp @@ -1,7 +1,9 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + #include "httpuws.h" #pragma warning(push) -#pragma warning(disable : 4244 4267 4458 4706) +#pragma warning(disable : 4244 4324 4267 4458 4706) #include #pragma warning(pop) @@ -42,12 +44,25 @@ HttpUwsServer::Run(bool TestMode) zen::logging::ConsoleLog().info("Zen Server running (null HTTP). Press ESC or Q to quit"); } - ::uWS::App().get("/*", [](uWS::HttpResponse* res, uWS::HttpRequest* req) { - res->end("Hello world!"); - ZEN_UNUSED(req); - }).listen(m_BasePort, [](auto* listen_socket) { - ZEN_UNUSED(listen_socket); - }).run(); + ::uWS::App() + .get("/*", + [](uWS::HttpResponse* res, uWS::HttpRequest* req) { + res->end("Hello world!"); + ZEN_UNUSED(req); + }) + .post("/*", + [](uWS::HttpResponse* res, uWS::HttpRequest* req) { + res->onData([&](std::string_view Data, bool fin) { + ZEN_UNUSED(Data); + if (fin) + res->end("Hello world!"); + }); + + res->onAborted([&] {}); + ZEN_UNUSED(req); + }) + .listen(m_BasePort, [](auto* listen_socket) { ZEN_UNUSED(listen_socket); }) + .run(); do { -- cgit v1.2.3