Skip to content

Commit 61dd28c

Browse files
committed
add unit test for non-utf8 header decoding
1 parent 4d596a2 commit 61dd28c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_custom_headers.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ async def test_http_custom_request_headers_in_span_attributes(self):
130130
(b"Regex-Test-Header-1", b"Regex Test Value 1"),
131131
(b"regex-test-header-2", b"RegexTestValue2,RegexTestValue3"),
132132
(b"My-Secret-Header", b"My Secret Value"),
133+
(
134+
b"non-utf8-header",
135+
b"Moto Z\xb2",
136+
),
133137
]
134138
)
135139
self.seed_app(self.app)
@@ -147,6 +151,7 @@ async def test_http_custom_request_headers_in_span_attributes(self):
147151
"http.request.header.regex_test_header_2": (
148152
"RegexTestValue2,RegexTestValue3",
149153
),
154+
"http.request.header.non_utf8_header": ("Moto Z²",),
150155
"http.request.header.my_secret_header": ("[REDACTED]",),
151156
}
152157
for span in span_list:
@@ -418,7 +423,7 @@ async def test_websocket_custom_response_headers_not_in_span_attributes(
418423

419424

420425
SANITIZE_FIELDS_TEST_VALUE = ".*my-secret.*"
421-
SERVER_REQUEST_TEST_VALUE = "Custom-Test-Header-1,Custom-Test-Header-2,Custom-Test-Header-3,Regex-Test-Header-.*,Regex-Invalid-Test-Header-.*,.*my-secret.*"
426+
SERVER_REQUEST_TEST_VALUE = "Custom-Test-Header-1,Custom-Test-Header-2,Custom-Test-Header-3,Regex-Test-Header-.*,Regex-Invalid-Test-Header-.*,.*my-secret.*,non-utf8-header"
422427
SERVER_RESPONSE_TEST_VALUE = "Custom-Test-Header-1,Custom-Test-Header-2,Custom-Test-Header-3,my-custom-regex-header-.*,invalid-regex-header-.*,.*my-secret.*"
423428

424429

0 commit comments

Comments
 (0)