Open yummybian opened 7 years ago
By using a handler with the request and the response arguments or with the return type of response, you can set http headers using response
object.
// 1. handler returns response
CROW_ROUTE(...)([]()
{
res.set_header("Content-Type", "image/jpeg");
return res;
}
// 2. handler with the response argument and call it's end()
CROW_ROUTE(...)([](const crow::request& req, crow::response& res)
{
res.set_header("Content-Type", "image/jpeg");
res.end();
}
@ipkn - Given there is such a method anyways then you should just consider getting rid of the json_value constructor on http_response.
I would like to build a response which contains image data. Where should I set content-type with "image/jpeg"?