8000 Fix AttributeError: 'str' object has no attribute 'decode' in Python … · amitaiturkel/client_python@41b7438 · GitHub
[go: up one dir, main page]

Skip to content

Commit 41b7438

Browse files
committed
Fix AttributeError: 'str' object has no attribute 'decode' in Python 3.11
Signed-off-by: amitaiturkel <amitai.turkel@gmail.com>
1 parent 37cd873 commit 41b7438

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

prometheus_client/asgi.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ async def prometheus_app(scope, receive, send):
1313
# Prepare parameters
1414
params = parse_qs(scope.get('query_string', b''))
1515
accept_header = ",".join([
16-
value.decode("utf8") for (name, value) in scope.get('headers')
17-
if name.decode("utf8").lower() == 'accept'
16+
value for (name, value) in scope.get('headers')
17+
if name.lower() == 'accept'
1818
])
1919
accept_encoding_header = ",".join([
20-
value.decode("utf8") for (name, value) in scope.get('headers')
21-
if name.decode("utf8").lower() == 'accept-encoding'
20+
value for (name, value) in scope.get('headers')
21+
if name.lower() == 'accept-encoding'
2222
])
2323
# Bake output
2424
status, headers, output = _bake_output(registry, accept_header, accept_encoding_header, params, disable_compression)

0 commit comments

Comments
 (0)
0