TrinityCore
HttpCommon.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_HTTP_COMMON_H
19#define TRINITYCORE_HTTP_COMMON_H
20
21#include "Define.h"
22#include <boost/beast/http/message.hpp>
23#include <boost/beast/http/string_body.hpp>
24
25namespace Trinity::Net::Http
26{
27using RequestBody = boost::beast::http::string_body;
28using ResponseBody = boost::beast::http::string_body;
29
30using Request = boost::beast::http::request<RequestBody>;
31using Response = boost::beast::http::response<ResponseBody>;
32
34{
37 struct RequestHandler const* handler = nullptr;
38};
39
42
43inline std::string_view ToStdStringView(boost::beast::string_view bsw)
44{
45 return { bsw.data(), bsw.size() };
46}
47
49{
50 Handled,
51 Error,
52 Async,
53};
54}
55#endif // TRINITYCORE_HTTP_COMMON_H
#define TC_SHARED_API
Definition: Define.h:117
boost::beast::http::string_body ResponseBody
Definition: HttpCommon.h:28
boost::beast::http::response< ResponseBody > Response
Definition: HttpCommon.h:31
std::string_view ToStdStringView(boost::beast::string_view bsw)
Definition: HttpCommon.h:43
boost::beast::http::string_body RequestBody
Definition: HttpCommon.h:27
TC_SHARED_API bool CanLogResponseContent(RequestContext const &context)
Definition: HttpService.cpp:33
boost::beast::http::request< RequestBody > Request
Definition: HttpCommon.h:30
TC_SHARED_API bool CanLogRequestContent(RequestContext const &context)
Definition: HttpService.cpp:28
void Error(char const *file, int line, char const *function, char const *message)
Definition: Errors.cpp:110
struct RequestHandler const * handler
Definition: HttpCommon.h:37