Skip to content

Commit 860c443

Browse files
fix: update pubsub_context to correctly modify proto map fields (#38)
1 parent d631626 commit 860c443

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

google/cloud/pubsublite/internal/wire/pubsub_context.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ def _version() -> _Semver:
2323
def pubsub_context(framework: Optional[str] = None) -> Mapping[str, str]:
2424
"""Construct the pubsub context mapping for the given framework."""
2525
context = struct_pb2.Struct()
26-
context.fields["language"] = struct_pb2.Value(string_value="PYTHON")
26+
context.fields["language"].string_value = "PYTHON"
2727
if framework:
28-
context.fields["framework"] = struct_pb2.Value(string_value=framework)
28+
context.fields["framework"].string_value = framework
2929
version = _version()
30-
context.fields["major_version"] = struct_pb2.Value(number_value=version.major)
31-
context.fields["minor_version"] = struct_pb2.Value(number_value=version.minor)
30+
context.fields["major_version"].number_value = version.major
31+
context.fields["minor_version"].number_value = version.minor
3232
encoded = b64encode(context.SerializeToString()).decode("utf-8")
3333
return {"x-goog-pubsub-context": encoded}

0 commit comments

Comments
 (0)