Exemplo n.º 1
0
Reply Reply::StockReply(Reply::status_type status)
{
    Reply reply;
    reply.status = status;
    reply.content.clear();

    const std::string status_string = reply.ToString(status);
    reply.content.insert(reply.content.end(), status_string.begin(), status_string.end());
    reply.headers.emplace_back("Access-Control-Allow-Origin", "*");
    reply.headers.emplace_back("Content-Length", cast::integral_to_string(reply.content.size()));
    reply.headers.emplace_back("Content-Type", "text/html");
    return reply;
}
Exemplo n.º 2
0
Reply Reply::StockReply(Reply::status_type status)
{
    Reply rep;
    rep.status = status;
    rep.content.clear();

    const std::string status_string = rep.ToString(status);
    rep.content.insert(rep.content.end(), status_string.begin(), status_string.end());
    rep.headers.resize(3);
    rep.headers[0].name = "Access-Control-Allow-Origin";
    rep.headers[0].value = "*";
    rep.headers[1].name = "Content-Length";

    std::string size_string = IntToString(rep.content.size());

    rep.headers[1].value = size_string;
    rep.headers[2].name = "Content-Type";
    rep.headers[2].value = "text/html";
    return rep;
}