Skip to content

Commit

Permalink
Remove case sensitive check in ASGIBrowserMiddleware check. (#1017)
Browse files Browse the repository at this point in the history
* Remove case sensitive check in should_insert_html.

* [Mega-Linter] Apply linters fixes

* Remove header decoding.

---------

Co-authored-by: umaannamalai <[email protected]>
  • Loading branch information
umaannamalai and umaannamalai authored Jan 4, 2024
1 parent c3314ae commit 3962f54
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions newrelic/api/asgi_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3962f54

Please sign in to comment.