рефактор + чистка кода
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "resource.h"
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <fstream>
|
||||
|
||||
static void loadFile(const std::string& path, std::vector<char>& content) {
|
||||
@@ -31,9 +30,9 @@ http::resource::StaticFileResource::StaticFileResource(const std::string &path,
|
||||
#endif
|
||||
}
|
||||
|
||||
void http::resource::StaticFileResource::handle(const server::request &req, server::reply &rep) {
|
||||
void http::resource::StaticFileResource::handle(const server::Request &req, server::reply &rep) {
|
||||
if (req.method != "GET") {
|
||||
stock_reply(server::bad_request, rep);
|
||||
stockReply(server::bad_request, rep);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,7 +47,7 @@ void http::resource::StaticFileResource::handle(const server::request &req, serv
|
||||
rep.status = server::ok;
|
||||
rep.headers.clear();
|
||||
// TODO сделать cache control
|
||||
rep.headers.push_back({.name = "Content-Type", .value = to_string(this->type)});
|
||||
rep.headers.push_back({.name = "Content-Type", .value = toString(this->type)});
|
||||
}
|
||||
|
||||
http::resource::StaticFileResource::~StaticFileResource() = default;
|
||||
@@ -57,7 +56,7 @@ http::resource::GenericResource::GenericResource(const std::string &path, const
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
void http::resource::GenericResource::handle(const server::request &req, server::reply &rep) {
|
||||
void http::resource::GenericResource::handle(const server::Request &req, server::reply &rep) {
|
||||
this->generator_(req, rep);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user