aboutsummaryrefslogtreecommitdiff
path: root/zenserver/testing/httptest.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-27 12:34:52 +0200
committerStefan Boberg <[email protected]>2021-09-27 12:34:52 +0200
commitf0036eada7f6bcf6e08afe3ea8517367ed73450e (patch)
treeb1ce3466bba36175cad369028fad1b410a34b5ec /zenserver/testing/httptest.cpp
parentFixed httpsys Windows compilation error (diff)
parentGetWindowsErrorAsString() -> GetSystemErrorAsString() (diff)
downloadzen-f0036eada7f6bcf6e08afe3ea8517367ed73450e.tar.xz
zen-f0036eada7f6bcf6e08afe3ea8517367ed73450e.zip
Merged latest from main
Diffstat (limited to 'zenserver/testing/httptest.cpp')
-rw-r--r--zenserver/testing/httptest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/zenserver/testing/httptest.cpp b/zenserver/testing/httptest.cpp
index c4fd6003c..18d63a6ef 100644
--- a/zenserver/testing/httptest.cpp
+++ b/zenserver/testing/httptest.cpp
@@ -2,6 +2,7 @@
#include "httptest.h"
+#include <zencore/compactbinarybuilder.h>
#include <zencore/compactbinarypackage.h>
namespace zen {
@@ -14,6 +15,16 @@ HttpTestingService::HttpTestingService()
HttpVerb::kGet);
m_Router.RegisterRoute(
+ "json",
+ [this](HttpRouterRequest& Req) {
+ CbObjectWriter Obj;
+ Obj.AddBool("ok", true);
+ Obj.AddInteger("counter", ++m_Counter);
+ Req.ServerRequest().WriteResponse(HttpResponseCode::OK, Obj.Save());
+ },
+ HttpVerb::kGet);
+
+ m_Router.RegisterRoute(
"echo",
[this](HttpRouterRequest& Req) {
IoBuffer Body = Req.ServerRequest().ReadPayload();