Skip to content

Commit 3962f54

Browse files
authored
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 <[email protected]>
1 parent c3314ae commit 3962f54

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

newrelic/api/asgi_application.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ def should_insert_html(self, headers):
9797
content_type = None
9898

9999
for header_name, header_value in headers:
100-
# assume header names are lower cased in accordance with ASGI spec
100+
# ASGI spec (https://asgi.readthedocs.io/en/latest/specs/www.html#http) states
101+
# header names should be lower cased, but not required
102+
header_name = header_name.lower()
101103
if header_name == b"content-type":
102104
content_type = header_value
103105
elif header_name == b"content-encoding":
@@ -318,7 +320,6 @@ async def nr_async_asgi(receive, send):
318320
send=send,
319321
source=wrapped,
320322
) as transaction:
321-
322323
# Record details of framework against the transaction for later
323324
# reporting as supportability metrics.
324325
if framework:

0 commit comments

Comments
 (0)