chore: Add X-Goog-API-Client header to GDA API requests

PiperOrigin-RevId: 869372484
This commit is contained in:
Google Team Member
2026-02-12 13:58:05 -08:00
committed by Copybara-Service
parent c6b1c74321
commit d85932faa3
4 changed files with 26 additions and 2 deletions
@@ -196,3 +196,16 @@ def test_get_stream_from_file(mock_post, case_file_path):
# 6. Assert that the final list of dicts matches the expected output
assert result == expected_final_list
def test_get_http_headers_includes_client_id():
"""Tests _get_http_headers includes the correct GDA client ID."""
mock_creds = mock.Mock()
mock_creds.token = "fake-token"
# pylint: disable=protected-access
headers = data_agent_tool._get_http_headers(mock_creds)
assert headers["X-Goog-API-Client"] == "GOOGLE_ADK"
assert headers["Content-Type"] == "application/json"
assert headers["Authorization"] == "Bearer fake-token"