Skip to content

Commit d685bf5

Browse files
committed
code review changes
1 parent 9bd0030 commit d685bf5

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_custom_headers.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ async def http_app_with_custom_headers(scope, receive, send):
4848
b"my-custom-regex-value-3,my-custom-regex-value-4",
4949
),
5050
(b"my-secret-header", b"my-secret-value"),
51+
(
52+
b"non-utf8-header",
53+
b"Moto Z\xb2",
54+
),
55+
(
56+
b"Moto-Z\xb2-non-utf8-header-key",
57+
b"Moto Z\xb2",
58+
),
5159
],
5260
}
5361
)
@@ -134,6 +142,10 @@ async def test_http_custom_request_headers_in_span_attributes(self):
134142
b"non-utf8-header",
135143
b"Moto Z\xb2",
136144
),
145+
(
146+
b"Moto-Z\xb2-non-utf8-header-key",
147+
b"Moto Z\xb2",
148+
),
137149
]
138150
)
139151
self.seed_app(self.app)
@@ -152,6 +164,7 @@ async def test_http_custom_request_headers_in_span_attributes(self):
152164
"RegexTestValue2,RegexTestValue3",
153165
),
154166
"http.request.header.non_utf8_header": ("Moto Z²",),
167+
"http.request.header.moto_z²_non_utf8_header_key": ("Moto Z²",),
155168
"http.request.header.my_secret_header": ("[REDACTED]",),
156169
}
157170
for span in span_list:
@@ -228,6 +241,8 @@ async def test_http_custom_response_headers_in_span_attributes(self):
228241
"my-custom-regex-value-3,my-custom-regex-value-4",
229242
),
230243
"http.response.header.my_secret_header": ("[REDACTED]",),
244+
"http.response.header.non_utf8_header": ("Moto Z²",),
245+
"http.response.header.moto_z²_non_utf8_header_key": ("Moto Z²",),
231246
}
232247
for span in span_list:
233248
if span.kind == SpanKind.SERVER:
@@ -423,8 +438,8 @@ async def test_websocket_custom_response_headers_not_in_span_attributes(
423438

424439

425440
SANITIZE_FIELDS_TEST_VALUE = ".*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"
427-
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.*"
441+
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,Moto-Z²-non-utf8-header-key"
442+
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.*,non-utf8-header,Moto-Z²-non-utf8-header-key"
428443

429444

430445
class TestCustomHeadersEnv(TestCustomHeaders):

0 commit comments

Comments
 (0)