blob: c1d9762ba20b40302ccb21c6fc5590eec0649ea9 (
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
|
#pragma once
#include <map>
#include <string>
enum class HttpStatusCode {
OK = 200,
Forbidden = 403
};
class HttpResponse {
public:
void add_header(const std::string& header, const std::string& value)
{
m_headers[header] = value;
}
void set_status_code(HttpStatusCode status_code) { m_status_code = status_code; }
void set_content(const std::string& content) { m_content = content; }
std::string to_string() const;
private:
HttpStatusCode m_status_code;
std::map<std::string, std::string> m_headers;
std::string m_content;
};
|