summaryrefslogtreecommitdiff
path: root/src/HttpResponse.h
blob: b0c0cd91508c9a1e403083a3943a16c450f3bf2e (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
#pragma once

#include <map>
#include <string>

enum class HttpStatusCode {
	OK = 200,
	Forbidden = 403,
	NotFound = 404,
	InternalServerError = 500,
};

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;
};