Skip to content

Commit 6483423

Browse files
committed
fix: Use string keys instead of bytes for Payload metadata
Payload.metadata expects string keys, not byte strings. This fixes pyright type errors in the ContextCodec test.
1 parent 487c6a1 commit 6483423

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_serialization_context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ async def encode(self, payloads: Sequence[Payload]) -> List[Payload]:
10841084
if self.context:
10851085
self.encode_called_with_context = True
10861086
# Just add a marker that we encoded with context
1087-
new_p.metadata[b"has_context"] = b"true"
1087+
new_p.metadata["has_context"] = b"true"
10881088
result.append(new_p)
10891089
return result
10901090

@@ -1093,10 +1093,10 @@ async def decode(self, payloads: Sequence[Payload]) -> List[Payload]:
10931093
for p in payloads:
10941094
new_p = Payload()
10951095
new_p.CopyFrom(p)
1096-
if self.context and new_p.metadata.get(b"has_context") == b"true":
1096+
if self.context and new_p.metadata.get("has_context") == b"true":
10971097
self.decode_called_with_context = True
10981098
# Remove the marker
1099-
del new_p.metadata[b"has_context"]
1099+
del new_p.metadata["has_context"]
11001100
result.append(new_p)
11011101
return result
11021102

0 commit comments

Comments
 (0)