Crow/include/crow/middlewares/utf-8.h
The-EDev f5338260bb several changes:
added json list in a similar fashion to json object
renamed object_type to object
updated readme, index.html, and json.md to include objects and lists
updated examples to be slightly cleaner and include lists
replaced instances of json object (std::map and such) with the short version (object)
accurate floating point number dumping (`6.0` instead of `6`) while taking 1/30th of the time (29 microseconds saved)
added json list testing
snuck in utf-8 middleware warning fix
snuck in twitter card style for crowcpp.org site (makes social media cards look way better with a large image)
2021-08-20 03:57:21 +03:00

28 lines
548 B
C++

#pragma once
#include "crow/http_request.h"
#include "crow/http_response.h"
namespace crow
{
struct UTF8
{
struct context
{
};
void before_handle(request& /*req*/, response& /*res*/, context& /*ctx*/)
{
}
void after_handle(request& /*req*/, response& res, context& /*ctx*/)
{
if (get_header_value(res.headers, "Content-Type").empty())
{
res.set_header("Content-Type", "text/plain; charset=utf-8");
}
}
};
}