From f6ee71a52da990b3bdc41bf56fcef87b30ca964b Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Mon, 27 Sep 2021 11:31:43 +0200 Subject: Added simple compact binary endpoint for JSON testing --- zenserver/testing/httptest.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'zenserver/testing/httptest.cpp') 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 #include namespace zen { @@ -13,6 +14,16 @@ HttpTestingService::HttpTestingService() [this](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponse(HttpResponseCode::OK); }, 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) { -- cgit v1.2.3