diff --git a/src/prometheus.ts b/src/prometheus.ts index db02661..3941dc8 100644 --- a/src/prometheus.ts +++ b/src/prometheus.ts @@ -34,7 +34,7 @@ export class MetricsRenderer { const retryAfterWhileDiscovery = 15 const textContentType = 'text/plain; charset=utf-8' const prometheusSpecVersion = '0.0.4' -const metricsContentType = `text/plain; version=${prometheusSpecVersion}` +const metricsContentType = `${textContentType}; version=${prometheusSpecVersion}` function headers(contentType: string, headers: Record = {}): Record { return { ...headers, 'Content-Type': contentType } diff --git a/tests/adapters/http/fastify.test.ts b/tests/adapters/http/fastify.test.ts index 82c8ca4..de6007f 100644 --- a/tests/adapters/http/fastify.test.ts +++ b/tests/adapters/http/fastify.test.ts @@ -55,7 +55,7 @@ describe('Fastify HTTP adapter', () => { return request(testServer.http) .get('/metrics') .expect(200) - .expect('Content-Type', 'text/plain; version=0.0.4') + .expect('Content-Type', 'text/plain; charset=utf-8; version=0.0.4') .expect( [ '# TYPE homebridge_metric gauge',