From d47847c997fee2d8efd81f1971f7344f00388e0d Mon Sep 17 00:00:00 2001 From: spxcds Date: Tue, 11 Oct 2022 01:29:30 +0800 Subject: [PATCH] Update http_server.cc (#4701) Change metrics http content type from "text/plain" to "text/plain; charset=utf-8". --- src/http_server.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/http_server.cc b/src/http_server.cc index 0a24a27554..45bdaefbce 100644 --- a/src/http_server.cc +++ b/src/http_server.cc @@ -144,6 +144,9 @@ HTTPMetricsServer::Handle(evhtp_request_t* req) } evhtp_res res = EVHTP_RES_BADREQ; + evhtp_headers_add_header( + req->headers_out, + evhtp_header_new(kContentTypeHeader, "text/plain; charset=utf-8", 1, 1)); // Call to metric endpoint should not have any trailing string if (RE2::FullMatch(std::string(req->uri->path->full), api_regex_)) {