diff --git a/common/src/main/java/org/a2aproject/sdk/common/MediaType.java b/common/src/main/java/org/a2aproject/sdk/common/MediaType.java index bbdd1d3a2..752fc468f 100644 --- a/common/src/main/java/org/a2aproject/sdk/common/MediaType.java +++ b/common/src/main/java/org/a2aproject/sdk/common/MediaType.java @@ -5,4 +5,7 @@ public interface MediaType { /** MIME type for JSON content: {@code application/json}. */ String APPLICATION_JSON = "application/json"; + + /** MIME type accepted from HTTP+JSON clients alongside {@code application/json}: {@code application/a2a+json}. */ + String APPLICATION_A2A_JSON = "application/a2a+json"; } diff --git a/reference/rest/src/main/java/org/a2aproject/sdk/server/rest/quarkus/A2AServerRoutes.java b/reference/rest/src/main/java/org/a2aproject/sdk/server/rest/quarkus/A2AServerRoutes.java index dac59c1ff..266d95333 100644 --- a/reference/rest/src/main/java/org/a2aproject/sdk/server/rest/quarkus/A2AServerRoutes.java +++ b/reference/rest/src/main/java/org/a2aproject/sdk/server/rest/quarkus/A2AServerRoutes.java @@ -1,5 +1,6 @@ package org.a2aproject.sdk.server.rest.quarkus; +import static org.a2aproject.sdk.common.MediaType.APPLICATION_A2A_JSON; import static org.a2aproject.sdk.server.ServerCallContext.TRANSPORT_KEY; import static org.a2aproject.sdk.spec.A2AMethods.CANCEL_TASK_METHOD; import static org.a2aproject.sdk.spec.A2AMethods.SEND_STREAMING_MESSAGE_METHOD; @@ -774,13 +775,14 @@ private String extractTenant(RoutingContext rc) { } /** - * Check if the request content type is application/json. + * Check if the request content type is application/json or application/a2a+json. * @param rc the routing context - * @return true if the content type is application/json - false otherwise. + * @return true if the content type is one of those - false otherwise. */ private boolean validateContentType(RoutingContext rc) { String contentType = rc.request().getHeader(CONTENT_TYPE); - if (contentType == null || !contentType.trim().startsWith(APPLICATION_JSON)) { + if (contentType == null || !(contentType.trim().startsWith(APPLICATION_JSON) + || contentType.trim().startsWith(APPLICATION_A2A_JSON))) { sendResponse(rc, jsonRestHandler.createErrorResponse(new ContentTypeNotSupportedError(null, null, null))); return false; }