From d45b6b9c46a2e3e4325a23b4ec66a562ff2a5639 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Wed, 13 Mar 2019 07:19:38 +0800 Subject: [PATCH] test content type html response https://github.com/moneroexamples/onion-monero-blockchain-explorer/issues/160#issuecomment-472205835 --- main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 2a7e544..da87608 100644 --- a/main.cpp +++ b/main.cpp @@ -17,6 +17,15 @@ using namespace std; namespace myxmr { +struct htmlresponse: crow::response +{ + htmlresponse(string&& _body) + : crow::response {std::move(_body)} + { + add_header("Content-Type", "text/html; charset=utf-8"); + } +}; + struct jsonresponse: crow::response { jsonresponse(const nlohmann::json& _body) @@ -291,7 +300,8 @@ main(int ac, const char* av[]) CROW_ROUTE(app, "/") ([&]() { - return crow::response(xmrblocks.index2()); + //return crow::response(xmrblocks.index2()); + return myxmr::htmlresponse(xmrblocks.index2()); }); CROW_ROUTE(app, "/page/")