Skip to content

feat: expose HTTP response headers in A2AHttpResponse and A2AClientHT…#922

Merged
ehsavoie merged 6 commits into
a2aproject:mainfrom
kabir:http-headers
Jun 10, 2026
Merged

feat: expose HTTP response headers in A2AHttpResponse and A2AClientHT…#922
ehsavoie merged 6 commits into
a2aproject:mainfrom
kabir:http-headers

Conversation

@kabir

@kabir kabir commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

…TPError

Add A2AHttpHeaders interface as a transport-independent abstraction over HTTP response headers, with implementations for JDK, Vert.x, and Android HTTP clients. Headers are also propagated into A2AClientHTTPError so callers can access headers like Retry-After (429) and WWW-Authenticate (401) from error responses.

This fixes #920

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a read-only abstraction for HTTP response headers (A2AHttpHeaders) and propagates these headers through HTTP clients, JSON-RPC transport, and REST error mappers into A2AClientHTTPError. This allows callers to inspect critical headers like Retry-After on rate-limited responses. Feedback highlights two key improvements: adding defensive null checks in the Android HTTP client to prevent a potential NullPointerException when parsing connection headers, and copying headers into a case-insensitive map within A2AClientHTTPError to preserve RFC 7230 case-insensitivity compliance.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread spec/src/main/java/org/a2aproject/sdk/spec/A2AClientHTTPError.java
kabir and others added 2 commits June 9, 2026 20:12
…TPError

Add A2AHttpHeaders interface as a transport-independent abstraction over
HTTP response headers, with implementations for JDK, Vert.x, and Android
HTTP clients. Headers are also propagated into A2AClientHTTPError so
callers can access headers like Retry-After (429) and WWW-Authenticate
(401) from error responses.

This fixes a2aproject#920

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kabir

kabir commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a read-only abstraction over HTTP response headers (A2AHttpHeaders) and integrates it across various HTTP client implementations (Android, Vert.x, JDK) and error mapping utilities, enabling callers to inspect headers like Retry-After during error handling. The feedback highlights several potential NullPointerException risks, specifically when handling null header names in the case-insensitive TreeMap and JDK/Vert.x implementations, as well as when copying header lists that might contain null elements.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread spec/src/main/java/org/a2aproject/sdk/spec/A2AClientHTTPError.java Outdated
Comment thread http-client/src/main/java/org/a2aproject/sdk/client/http/JdkA2AHttpClient.java Outdated
@kabir

kabir commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the SDK's HTTP client and error handling by propagating HTTP response headers into client exceptions, specifically via A2AClientHTTPError. This allows callers to inspect headers like Retry-After on rate-limited responses. The changes span multiple transport implementations (JDK, Android, Vert.x, JSON-RPC, and REST) and include new utility classes and comprehensive tests. The review feedback focuses on improving robustness by defensively guarding against potential NullPointerExceptions, such as checking for null headers on HTTP responses and filtering null elements in HttpHeaderUtils.copyOfCaseInsensitive before copying lists.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread common/src/main/java/org/a2aproject/sdk/util/HttpHeaderUtils.java
@ehsavoie ehsavoie merged commit a57c919 into a2aproject:main Jun 10, 2026
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: A2AHttpResponse should expose response headers

2 participants