1616
1717import httpx
1818import pytest
19+ from httpx import __version__ as httpx_version
20+ from mcp_proxy_for_aws import __version__
1921from mcp_proxy_for_aws .sigv4_helper import (
2022 SENSITIVE_HEADERS ,
2123 SigV4HTTPXAuth ,
@@ -142,6 +144,8 @@ def test_create_sigv4_client_default(self, mock_client_class, mock_create_sessio
142144 assert len (call_args [1 ]['event_hooks' ]['response' ]) == 1
143145 assert len (call_args [1 ]['event_hooks' ]['request' ]) == 2 # metadata + sign hooks
144146 assert call_args [1 ]['headers' ]['Accept' ] == 'application/json, text/event-stream'
147+ expected_user_agent = f'python-httpx/{ httpx_version } mcp-proxy-for-aws/{ __version__ } '
148+ assert call_args [1 ]['headers' ]['User-Agent' ] == expected_user_agent
145149 assert result == mock_client
146150
147151 @patch ('mcp_proxy_for_aws.sigv4_helper.create_aws_session' )
@@ -163,6 +167,7 @@ def test_create_sigv4_client_with_custom_headers(self, mock_client_class, mock_c
163167 call_args = mock_client_class .call_args
164168 expected_headers = {
165169 'Accept' : 'application/json, text/event-stream' ,
170+ 'User-Agent' : f'python-httpx/{ httpx_version } mcp-proxy-for-aws/{ __version__ } ' ,
166171 'Custom-Header' : 'custom-value' ,
167172 }
168173 assert call_args [1 ]['headers' ] == expected_headers
@@ -245,6 +250,7 @@ def test_create_sigv4_client_with_prompt_context(self, mock_client_class, mock_c
245250 # Verify headers include both default and prompt-context headers
246251 expected_headers = {
247252 'Accept' : 'application/json, text/event-stream' ,
253+ 'User-Agent' : f'python-httpx/{ httpx_version } mcp-proxy-for-aws/{ __version__ } ' ,
248254 'X-MCP-Prompt-Context' : 'enabled' ,
249255 'Content-Type' : 'application/json' ,
250256 }
0 commit comments