Add namespace

This commit is contained in:
Pablu23
2024-07-11 18:34:11 +02:00
parent e9a7062c07
commit 87b717545b
10 changed files with 34 additions and 12 deletions

View File

@@ -1,11 +1,16 @@
#include "response.hpp"
#include "http.hpp"
#include <algorithm>
#include <cstring>
#include <iostream>
#include <netinet/in.h>
#include <sstream>
Response::Response(http::statusCode statusCode) { m_statusCode = statusCode; }
using namespace http;
Response::Response(statuscode::statusCode statusCode) {
m_statusCode = statusCode;
}
void Response::SetPayload(std::vector<std::byte> data) {
m_headers.insert(std::pair<std::string, std::string>(
@@ -29,7 +34,7 @@ void Response::SetContentType(const std::string type) {
void Response::Send(int clientSocket) {
std::stringstream ss;
ss << "HTTP/1.1 " << m_statusCode << " "
<< http::StatusCodeString(m_statusCode) << "\n";
<< statuscode::StatusCodeString(m_statusCode) << "\n";
for (const auto &[key, value] : m_headers) {
ss << key << ": " << value << "\n";
}