blob: 0639c2b539622fa6ba403fa48435ea01ae89d3c8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// Copyright Epic Games, Inc. All Rights Reserved.
#include "httptest.h"
namespace zen {
HttpTestingService::HttpTestingService()
{
m_Router.RegisterRoute(
"hello",
[this](HttpRouterRequest& Req) { Req.ServerRequest().WriteResponse(HttpResponse::OK); },
HttpVerb::kGet);
m_Router.RegisterRoute(
"echo",
[this](HttpRouterRequest& Req) {
IoBuffer Body = Req.ServerRequest().ReadPayload();
Req.ServerRequest().WriteResponse(HttpResponse::OK, HttpContentType::kBinary, Body);
},
HttpVerb::kPost);
m_Router.RegisterRoute("package", m_PackageHandler);
}
HttpTestingService::~HttpTestingService()
{
}
const char*
HttpTestingService::BaseUri() const
{
return "/testing/";
}
void
HttpTestingService::HandleRequest(HttpServerRequest& Request)
{
m_Router.HandleRequest(Request);
}
void
HttpTestingService::PackageHandler::HandleRequest(HttpRouterRequest& Req)
{
IoBuffer Body = Req.ServerRequest().ReadPayload();
Req.ServerRequest().WriteResponse(HttpResponse::OK, HttpContentType::kBinary, Body);
}
} // namespace zen
|