This repository has been archived on 2026-04-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
short-link-backend/includes/request_handler.hpp

23 lines
No EOL
626 B
C++

#ifndef REQUEST_HANDLER_HPP
#define REQUEST_HANDLER_HPP
#include <boost/beast/http.hpp>
#include <boost/beast/http/message.hpp>
#include <boost/beast/http/string_body.hpp>
#include <variant>
using namespace boost::beast;
class RequestHandler {
public:
std::variant<
http::response<http::string_body>,
http::response<http::file_body>
> handle(const http::request<http::string_body>& request);
private:
http::response<http::string_body> BadRequest(const std::string& why);
http::response<http::file_body> handle_file_request(const std::string& filename, boost::system::error_code& ec);
};
#endif