From 68eff1dc4b20cace0bc0dcc43b10a21e5edac682 Mon Sep 17 00:00:00 2001 From: Alejandro Revilla Date: Thu, 9 Jan 2025 20:29:19 -0300 Subject: [PATCH] Prometheus now requires Content-Type --- jpos/src/main/java/org/jpos/metrics/PrometheusService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jpos/src/main/java/org/jpos/metrics/PrometheusService.java b/jpos/src/main/java/org/jpos/metrics/PrometheusService.java index 1c678a4f33..9770fead2a 100644 --- a/jpos/src/main/java/org/jpos/metrics/PrometheusService.java +++ b/jpos/src/main/java/org/jpos/metrics/PrometheusService.java @@ -42,6 +42,7 @@ protected void startService() throws ConfigurationException { server = HttpServer.create(new InetSocketAddress(port), 0); server.createContext(path, httpExchange -> { String response = registry.scrape(); + httpExchange.getResponseHeaders().add("Content-Type", "text/plain; version=0.0.4"); httpExchange.sendResponseHeaders(200, response.getBytes().length); try (OutputStream os = httpExchange.getResponseBody()) { os.write(response.getBytes());