blob: a8779445d93b6aa920a61b1c18614649289f55aa (
plain)
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
|
#pragma once
#include "server.h"
#include <boost/beast/http.hpp>
#include <exception>
#include <string>
namespace beast = boost::beast; // from <boost/beast.hpp>
namespace http = beast::http; // from <boost/beast/http.hpp>
class http_exception: public std::exception
{
std::string m_message;
public:
http_exception(std::string message);
virtual const char* what() const noexcept;
};
class bad_request_exception: public http_exception
{
public:
bad_request_exception(std::string message);
};
class not_found_exception: public http_exception
{
public:
not_found_exception(std::string message);
};
class server_error_exception: public http_exception
{
public:
server_error_exception(std::string message);
};
std::string extend_index_html(std::string path);
std::string generate_response(http::request<http::string_body>& req, http::response<http::string_body>& res, Server& server);
|