2021-08-15 12:28:26 +00:00
|
|
|
#pragma once
|
|
|
|
#include "crow/http_request.h"
|
|
|
|
#include "crow/http_response.h"
|
|
|
|
|
|
|
|
namespace crow
|
|
|
|
{
|
|
|
|
|
|
|
|
struct UTF8
|
|
|
|
{
|
|
|
|
struct context
|
2021-11-27 12:28:50 +00:00
|
|
|
{};
|
2021-08-15 12:28:26 +00:00
|
|
|
|
|
|
|
void before_handle(request& /*req*/, response& /*res*/, context& /*ctx*/)
|
2021-11-27 12:28:50 +00:00
|
|
|
{}
|
2021-08-15 12:28:26 +00:00
|
|
|
|
2021-08-20 00:57:21 +00:00
|
|
|
void after_handle(request& /*req*/, response& res, context& /*ctx*/)
|
2021-08-15 12:28:26 +00:00
|
|
|
{
|
|
|
|
if (get_header_value(res.headers, "Content-Type").empty())
|
|
|
|
{
|
|
|
|
res.set_header("Content-Type", "text/plain; charset=utf-8");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-11-25 11:45:38 +00:00
|
|
|
} // namespace crow
|