Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(metrics): cover backslash and newline label escaping
Yudhi Armyndharis179f1798b0e9
diff --git a/src/common/metrics/request-metrics.spec.ts b/src/common/metrics/request-metrics.spec.tsindex 5399c0fab..cd7a8bfad 100644--- a/src/common/metrics/request-metrics.spec.ts+++ b/src/common/metrics/request-metrics.spec.ts@@ -42,6 +42,8 @@ describe('request-metrics (HTTP RED store)', () => {it('escapes special label characters (quote, backslash, newline) in the route label', () => {recordHttpRequest('GET', '/api/"weird"/path', 200, 0.01);expect(lines()).toContain('route="/api/\\"weird\\"/path"');+ recordHttpRequest('GET', 'a\\b\nc', 200, 0.01);+ expect(lines()).toContain('route="a\\\\b\\nc"');});it('reset clears both the counter and the histogram', () => {