MCPcopy Index your code
hub / github.com/prometheus/client_python / test_openmetrics_encoding

Method test_openmetrics_encoding

tests/test_asgi.py:175–183  ·  view source on GitHub ↗

Response content type is application/openmetrics-text when appropriate Accept header is in request

(self)

Source from the content-addressed store, hash-verified

173 self.assert_outputs(outputs, metric_name, help_text, increments, compressed=False)
174
175 def test_openmetrics_encoding(self):
176 """Response content type is application/openmetrics-text when appropriate Accept header is in request"""
177 app = make_asgi_app(self.registry)
178 self.seed_app(app)
179 self.scope["headers"] = [(b"Accept", b"application/openmetrics-text; version=1.0.0")]
180 self.send_input({"type": "http.request", "body": b""})
181
182 content_type = self.get_response_header_value('Content-Type').split(";")[0]
183 assert content_type == "application/openmetrics-text"
184
185 def test_plaintext_encoding(self):
186 """Response content type is text/plain when Accept header is missing in request"""

Callers

nothing calls this directly

Calls 4

seed_appMethod · 0.95
send_inputMethod · 0.95
make_asgi_appFunction · 0.90

Tested by

no test coverage detected