-
Notifications
You must be signed in to change notification settings - Fork 381
fix: add extra grpc header which is all lower case #756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |||||||||
| import pytest | ||||||||||
|
|
||||||||||
| from a2a import types | ||||||||||
| from a2a.extensions.common import HTTP_EXTENSION_HEADER | ||||||||||
| from a2a.extensions.common import GRPC_EXTENSION_HEADER | ||||||||||
| from a2a.grpc import a2a_pb2 | ||||||||||
| from a2a.server.context import ServerCallContext | ||||||||||
| from a2a.server.request_handlers import GrpcHandler, RequestHandler | ||||||||||
|
|
@@ -350,8 +350,8 @@ async def test_send_message_with_extensions( | |||||||||
| mock_grpc_context: AsyncMock, | ||||||||||
| ) -> None: | ||||||||||
| mock_grpc_context.invocation_metadata.return_value = grpc.aio.Metadata( | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'foo'), | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'bar'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'foo'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'bar'), | ||||||||||
|
Comment on lines
+353
to
+354
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||
| ) | ||||||||||
|
|
||||||||||
| def side_effect(request, context: ServerCallContext): | ||||||||||
|
|
@@ -379,8 +379,8 @@ def side_effect(request, context: ServerCallContext): | |||||||||
| mock_grpc_context.set_trailing_metadata.call_args.args[0] | ||||||||||
| ) | ||||||||||
| assert set(called_metadata) == { | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'foo'), | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'baz'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'foo'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'baz'), | ||||||||||
|
Comment on lines
+382
to
+383
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||
| } | ||||||||||
|
|
||||||||||
| async def test_send_message_with_comma_separated_extensions( | ||||||||||
|
|
@@ -390,8 +390,8 @@ async def test_send_message_with_comma_separated_extensions( | |||||||||
| mock_grpc_context: AsyncMock, | ||||||||||
| ) -> None: | ||||||||||
| mock_grpc_context.invocation_metadata.return_value = grpc.aio.Metadata( | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'foo ,, bar,'), | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'baz , bar'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'foo ,, bar,'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'baz , bar'), | ||||||||||
|
Comment on lines
+393
to
+394
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||
| ) | ||||||||||
| mock_request_handler.on_message_send.return_value = types.Message( | ||||||||||
| message_id='1', | ||||||||||
|
|
@@ -415,8 +415,8 @@ async def test_send_streaming_message_with_extensions( | |||||||||
| mock_grpc_context: AsyncMock, | ||||||||||
| ) -> None: | ||||||||||
| mock_grpc_context.invocation_metadata.return_value = grpc.aio.Metadata( | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'foo'), | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'bar'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'foo'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'bar'), | ||||||||||
|
Comment on lines
+418
to
+419
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||
| ) | ||||||||||
|
|
||||||||||
| async def side_effect(request, context: ServerCallContext): | ||||||||||
|
|
@@ -450,6 +450,6 @@ async def side_effect(request, context: ServerCallContext): | |||||||||
| mock_grpc_context.set_trailing_metadata.call_args.args[0] | ||||||||||
| ) | ||||||||||
| assert set(called_metadata) == { | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'foo'), | ||||||||||
| (HTTP_EXTENSION_HEADER.lower(), 'baz'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'foo'), | ||||||||||
| (GRPC_EXTENSION_HEADER.lower(), 'baz'), | ||||||||||
|
Comment on lines
+453
to
+454
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||
| } | ||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
GRPC_EXTENSION_HEADERconstant is already in lowercase. The call to.lower()is redundant and can be removed for clarity.