From 3962f54d91bef1980523f40eb4649ef354634396 Mon Sep 17 00:00:00 2001 From: Uma Annamalai Date: Thu, 4 Jan 2024 12:50:58 -0800 Subject: [PATCH] Remove case sensitive check in ASGIBrowserMiddleware check. (#1017) * Remove case sensitive check in should_insert_html. * [Mega-Linter] Apply linters fixes * Remove header decoding. --------- Co-authored-by: umaannamalai --- newrelic/api/asgi_application.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/newrelic/api/asgi_application.py b/newrelic/api/asgi_application.py index 2e4e4979b3..201e8643e6 100644 --- a/newrelic/api/asgi_application.py +++ b/newrelic/api/asgi_application.py @@ -97,7 +97,9 @@ def should_insert_html(self, headers): content_type = None for header_name, header_value in headers: - # assume header names are lower cased in accordance with ASGI spec + # ASGI spec (https://asgi.readthedocs.io/en/latest/specs/www.html#http) states + # header names should be lower cased, but not required + header_name = header_name.lower() if header_name == b"content-type": content_type = header_value elif header_name == b"content-encoding": @@ -318,7 +320,6 @@ async def nr_async_asgi(receive, send): send=send, source=wrapped, ) as transaction: - # Record details of framework against the transaction for later # reporting as supportability metrics. if framework: