Initial commit

This commit is contained in:
2019-06-15 12:00:21 +02:00
commit eda5d9df6b
31 changed files with 1328 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#include "notfound.hpp"
#include <sstream>
namespace Middleware
{
void NotFound::HandleRequest(Http::Request const & request, Http::Response & response)
{
if (response.code != HttpResponse::Code::UNKNOWN)
{
return;
}
response.code = HttpResponse::Code::NOT_FOUND;
std::stringstream ss;
ss << "404 - file not found\n";
ss << "File: ";
ss << request.path << '\n';
auto responseContent = ss.str();
response.content.insert(response.content.begin(),
responseContent.begin(),
responseContent.end());
response.contentType = "text/plain";
}
}