pica/response/response.h
2023-11-23 16:57:32 -03:00

39 lines
644 B
C++

#pragma once
#include <string>
#include <array>
#include <string_view>
#include <nlohmann/json.hpp>
#include "request/request.h"
#include "stream/ostream.h"
class Response {
public:
enum class Status {
ok,
notFound,
methodNotAllowed,
internalError,
__size
};
enum class ContentType {
text,
json,
__size
};
Response();
Response(Status status);
void replyTo(Request& request) const;
void setBody(const std::string& body);
void setBody(const nlohmann::json& body);
private:
Status status;
ContentType type;
std::string body;
};