File: MethodTest.cc

package info (click to toggle)
drogon 1.9.11%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,820 kB
  • sloc: cpp: 57,270; sh: 297; xml: 20; makefile: 11
file content (56 lines) | stat: -rw-r--r-- 1,440 bytes parent folder | download
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
49
50
51
52
53
54
55
56
#include "MethodTest.h"

static void makeGetRespose(
    const std::function<void(const HttpResponsePtr &)> &callback)
{
    callback(drogon::HttpResponse::newHttpJsonResponse("GET"));
}

static void makePostRespose(
    const std::function<void(const HttpResponsePtr &)> &callback)
{
    callback(drogon::HttpResponse::newHttpJsonResponse("POST"));
}

void MethodTest::get(const HttpRequestPtr &req,
                     std::function<void(const HttpResponsePtr &)> &&callback)
{
    LOG_DEBUG;
    makeGetRespose(callback);
}

void MethodTest::post(const HttpRequestPtr &req,
                      std::function<void(const HttpResponsePtr &)> &&callback,
                      std::string str)
{
    LOG_DEBUG << str;
    makePostRespose(callback);
}

void MethodTest::getReg(const HttpRequestPtr &req,
                        std::function<void(const HttpResponsePtr &)> &&callback,
                        std::string regStr)
{
    LOG_DEBUG << regStr;
    makeGetRespose(callback);
}

void MethodTest::postReg(
    const HttpRequestPtr &req,
    std::function<void(const HttpResponsePtr &)> &&callback,
    std::string regStr,
    std::string str)
{
    LOG_DEBUG << regStr;
    LOG_DEBUG << str;
    makePostRespose(callback);
}

void MethodTest::postRegex(
    const HttpRequestPtr &req,
    std::function<void(const HttpResponsePtr &)> &&callback,
    std::string regStr)
{
    LOG_DEBUG << regStr;
    makePostRespose(callback);
}