1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Exporter: Listen at port 9972 for Prometheus exporter. (#3195)

This commit is contained in:
chundonglinlin 2022-10-01 07:35:54 +08:00 committed by GitHub
parent 4ad4dd0975
commit 9525511032
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 105 additions and 4 deletions

View file

@ -87,7 +87,9 @@ srs_error_t srs_api_response_json(ISrsHttpResponseWriter* w, string data)
SrsHttpHeader* h = w->header();
h->set_content_length(data.length());
h->set_content_type("application/json");
if (h->content_type().empty()) {
h->set_content_type("application/json");
}
if ((err = w->write((char*)data.data(), (int)data.length())) != srs_success) {
return srs_error_wrap(err, "write json");
@ -1153,5 +1155,7 @@ srs_error_t SrsGoApiMetrics::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
<< nerrs
<< "\n";
w->header()->set_content_type("text/plain; charset=utf-8");
return srs_api_response(w, r, ss.str());
}