Skip to content

fix: use application/json Content-Type for HTTP+JSON error responses#769

Open
jmesnil wants to merge 3 commits intoa2aproject:mainfrom
jmesnil:768_application_json_for_errors
Open

fix: use application/json Content-Type for HTTP+JSON error responses#769
jmesnil wants to merge 3 commits intoa2aproject:mainfrom
jmesnil:768_application_json_for_errors

Conversation

@jmesnil
Copy link
Copy Markdown
Collaborator

@jmesnil jmesnil commented Mar 25, 2026

The spec is not explicit on that but the error responses should all use application/json.

  • in JSON-RPC, an error response is a regular JSON-RPC response
  • in HTTP+JSON, the error payload was moved from RFC 9457 to AIP-193 so the RFC-9457's application/problem+json no longer makes sense.

This fixes #768

The spec is not explicit on that but the error responses should all use `application/json`.

* in JSON-RPC, an error response is a regular JSON-RPC response
* in HTTP+JSON, the error payload was moved from RFC 9457 to AIP-193 so the RFC-9457's `application/problem+json` no longer makes sense.

This fixes a2aproject#768
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request standardizes the Content-Type header for error responses in both JSON-RPC and HTTP+JSON interactions to application/json. This change aligns the system with current best practices and updated specifications, moving away from application/problem+json which is no longer relevant for these error payloads. The update ensures consistent and correct content type reporting for all error scenarios.

Highlights

  • Content-Type Standardization: Standardized the Content-Type header for HTTP+JSON error responses to application/json across the application.
  • Removal of application/problem+json: Removed the APPLICATION_PROBLEM_JSON constant and all its references, aligning with updated specifications where application/problem+json is no longer relevant for these error payloads.
  • Test Updates: Updated various test cases to reflect the new application/json content type for error responses, including renaming test methods and modifying assertions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

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

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 standardizes the Content-Type for error responses across JSON-RPC and REST transports to application/json, removing the APPLICATION_PROBLEM_JSON media type. This involves updating MediaType.java, removing related imports, modifying Content-Type headers in error handling logic, and adjusting corresponding test assertions. The review feedback highlights an opportunity to improve maintainability by replacing hardcoded "application/json" strings with the APPLICATION_JSON constant in test files, specifically in A2AServerRoutesTest.java and RestHandlerTest.java.

Signed-off-by: Jeff Mesnil <jmesnil@ibm.com>
@jmesnil
Copy link
Copy Markdown
Collaborator Author

jmesnil commented Mar 25, 2026

/gemini review

Copy link
Copy Markdown
Contributor

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

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 standardizes the content type for all JSON responses to application/json, removing the distinction previously made with application/problem+json. This change involves removing the APPLICATION_PROBLEM_JSON constant from io.a2a.common.MediaType, updating A2AServerRoutes and RestHandler to consistently use APPLICATION_JSON for both success and error responses, and refactoring associated test files to reflect these new content type expectations. Minor code style and Javadoc updates were also included.

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.

[Bug]: HTTP+JSON error responses use Content-Type application/problem+json instead of application/json

1 participant