From eae33bca107e4203fa154131498c91e73ee8e212 Mon Sep 17 00:00:00 2001 From: JakubWorek Date: Fri, 25 Sep 2026 11:28:45 +0000 Subject: [PATCH 1/2] fix(rest): support application/a2a+json content type --- .../org/a2aproject/sdk/common/MediaType.java | 3 ++ .../server/rest/quarkus/A2AServerRoutes.java | 8 ++-- .../transport/rest/handler/RestHandler.java | 5 ++- .../rest/handler/RestHandlerTest.java | 42 ++++++++++--------- 4 files changed, 33 insertions(+), 25 deletions(-) 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..f6ea44711 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 the HTTP+JSON binding should use (A2A spec section 11): {@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; } diff --git a/transport/rest/src/main/java/org/a2aproject/sdk/transport/rest/handler/RestHandler.java b/transport/rest/src/main/java/org/a2aproject/sdk/transport/rest/handler/RestHandler.java index b35beb8c2..77f9e0d6a 100644 --- a/transport/rest/src/main/java/org/a2aproject/sdk/transport/rest/handler/RestHandler.java +++ b/transport/rest/src/main/java/org/a2aproject/sdk/transport/rest/handler/RestHandler.java @@ -1,5 +1,6 @@ package org.a2aproject.sdk.transport.rest.handler; +import static org.a2aproject.sdk.common.MediaType.APPLICATION_A2A_JSON; import static org.a2aproject.sdk.common.MediaType.APPLICATION_JSON; import static org.a2aproject.sdk.server.util.async.AsyncUtils.createTubeConfig; @@ -702,7 +703,7 @@ private HTTPRestResponse createSuccessResponse(int statusCode, com.google.protob try { // Include default value fields to ensure empty arrays, zeros, etc. are present in JSON String jsonBody = ProtoJsonUtils.toJson(JsonFormat.printer().alwaysPrintFieldsWithNoPresence(), builder); - return new HTTPRestResponse(statusCode, APPLICATION_JSON, jsonBody); + return new HTTPRestResponse(statusCode, APPLICATION_A2A_JSON, jsonBody); } catch (InvalidProtocolBufferException e) { LOGGER.log(Level.SEVERE, "Failed to serialize response", e); return createErrorResponse(new InternalError("Internal error")); @@ -722,7 +723,7 @@ public HTTPRestResponse createErrorResponse(A2AError error) { private HTTPRestResponse createErrorResponse(int statusCode, A2AError error) { String jsonBody = new HTTPRestErrorResponse(error).toJson(); - return new HTTPRestResponse(statusCode, APPLICATION_JSON, jsonBody); + return new HTTPRestResponse(statusCode, APPLICATION_A2A_JSON, jsonBody); } /** diff --git a/transport/rest/src/test/java/org/a2aproject/sdk/transport/rest/handler/RestHandlerTest.java b/transport/rest/src/test/java/org/a2aproject/sdk/transport/rest/handler/RestHandlerTest.java index b170e28ee..cff56a1b4 100644 --- a/transport/rest/src/test/java/org/a2aproject/sdk/transport/rest/handler/RestHandlerTest.java +++ b/transport/rest/src/test/java/org/a2aproject/sdk/transport/rest/handler/RestHandlerTest.java @@ -1,5 +1,6 @@ package org.a2aproject.sdk.transport.rest.handler; +import static org.a2aproject.sdk.common.MediaType.APPLICATION_A2A_JSON; import static org.a2aproject.sdk.common.MediaType.APPLICATION_JSON; import java.util.Collections; @@ -59,13 +60,13 @@ public void testGetTaskSuccess() { RestHandler.HTTPRestResponse response = handler.getTask(callContext, "", MINIMAL_TASK.id(), 0); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); response = handler.getTask(callContext, "", MINIMAL_TASK.id(), 2); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -98,7 +99,7 @@ public void testListTasksStatusWireString() { null, null, null); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -140,7 +141,7 @@ public void testSendMessage() throws InvalidProtocolBufferException { RestHandler.HTTPRestResponse response = handler.sendMessage(callContext, "", requestBody); Assertions.assertEquals(200, response.getStatusCode(), response.toString()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -175,7 +176,7 @@ public void testSendMessageWrongValueBody() { RestHandler.HTTPRestResponse response = handler.sendMessage(callContext, "", requestBody); Assertions.assertEquals(422, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); JsonObject body = JsonParser.parseString(response.getBody()).getAsJsonObject(); JsonObject error = body.getAsJsonObject("error"); Assertions.assertEquals(422, error.get("code").getAsInt()); @@ -211,7 +212,7 @@ public void testCancelTaskSuccess() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -253,7 +254,7 @@ public void testCancelTaskWithMetadata() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -277,7 +278,7 @@ public void testCancelTaskWithEmptyMetadata() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -297,7 +298,7 @@ public void testCancelTaskWithNoMetadata() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -315,7 +316,7 @@ public void testCancelTaskWithNullBody() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", null, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -390,7 +391,7 @@ public void testPushNotificationConfigSuccess() { RestHandler.HTTPRestResponse response = handler.createTaskPushNotificationConfiguration(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(201, response.getStatusCode(), response.toString()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -431,11 +432,11 @@ public void testGetPushNotificationConfig() { }""".formatted(MINIMAL_TASK.id()); RestHandler.HTTPRestResponse response = handler.createTaskPushNotificationConfiguration(callContext, "", createRequestBody, MINIMAL_TASK.id()); Assertions.assertEquals(201, response.getStatusCode(), response.toString()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); // Now get it response = handler.getTaskPushNotificationConfiguration(callContext, "", MINIMAL_TASK.id(), "default-config-id"); Assertions.assertEquals(200, response.getStatusCode(), response.toString()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); } @Test @@ -454,7 +455,7 @@ public void testListPushNotificationConfigs() { RestHandler.HTTPRestResponse response = handler.listTaskPushNotificationConfigurations(callContext, "", MINIMAL_TASK.id(), 0, ""); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -783,7 +784,7 @@ public void testRequiredExtensionProvidedSuccess() { // Should succeed without error Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -984,7 +985,7 @@ public void testCompatibleVersionSuccess() { // Should succeed without error Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -1070,7 +1071,7 @@ public void testListTasksProtobufEnumStatus() { null, null, null); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -1084,7 +1085,7 @@ public void testListTasksEnumConstantStatus() { null, null, null); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -1097,7 +1098,7 @@ public void testListTasksEmptyResultIncludesAllFields() { null, null, null); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); String body = response.getBody(); // Verify all required fields are present (not missing) @@ -1121,7 +1122,7 @@ void constructorDoesNotResolveAgentCardInstances() { private static void assertProblemDetail(RestHandler.HTTPRestResponse response, int expectedStatus, String expectedReason, String expectedMessage) { Assertions.assertEquals(expectedStatus, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); JsonObject body = JsonParser.parseString(response.getBody()).getAsJsonObject(); Assertions.assertTrue(body.has("error"), "error wrapper should be present"); JsonObject error = body.getAsJsonObject("error"); @@ -1264,6 +1265,7 @@ public void testExtendedAgentCardWithRouterKnownTenant() { RestHandler.HTTPRestResponse response = handler.getExtendedAgentCard(callContext, "acme"); Assertions.assertEquals(200, response.getStatusCode()); + // The agent card is discovery over plain HTTP, not an A2A protocol response. Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains("acme-card")); } From 8ad8f08be6991f11ef3824e5bbf2a854c24f2cff Mon Sep 17 00:00:00 2001 From: JakubWorek Date: Fri, 25 Sep 2026 15:56:36 +0000 Subject: [PATCH 2/2] refactor(rest): accept a2a+json on server but send old one --- .../org/a2aproject/sdk/common/MediaType.java | 2 +- .../transport/rest/handler/RestHandler.java | 5 +-- .../rest/handler/RestHandlerTest.java | 42 +++++++++---------- 3 files changed, 23 insertions(+), 26 deletions(-) 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 f6ea44711..752fc468f 100644 --- a/common/src/main/java/org/a2aproject/sdk/common/MediaType.java +++ b/common/src/main/java/org/a2aproject/sdk/common/MediaType.java @@ -6,6 +6,6 @@ public interface MediaType { /** MIME type for JSON content: {@code application/json}. */ String APPLICATION_JSON = "application/json"; - /** MIME type the HTTP+JSON binding should use (A2A spec section 11): {@code application/a2a+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/transport/rest/src/main/java/org/a2aproject/sdk/transport/rest/handler/RestHandler.java b/transport/rest/src/main/java/org/a2aproject/sdk/transport/rest/handler/RestHandler.java index 77f9e0d6a..b35beb8c2 100644 --- a/transport/rest/src/main/java/org/a2aproject/sdk/transport/rest/handler/RestHandler.java +++ b/transport/rest/src/main/java/org/a2aproject/sdk/transport/rest/handler/RestHandler.java @@ -1,6 +1,5 @@ package org.a2aproject.sdk.transport.rest.handler; -import static org.a2aproject.sdk.common.MediaType.APPLICATION_A2A_JSON; import static org.a2aproject.sdk.common.MediaType.APPLICATION_JSON; import static org.a2aproject.sdk.server.util.async.AsyncUtils.createTubeConfig; @@ -703,7 +702,7 @@ private HTTPRestResponse createSuccessResponse(int statusCode, com.google.protob try { // Include default value fields to ensure empty arrays, zeros, etc. are present in JSON String jsonBody = ProtoJsonUtils.toJson(JsonFormat.printer().alwaysPrintFieldsWithNoPresence(), builder); - return new HTTPRestResponse(statusCode, APPLICATION_A2A_JSON, jsonBody); + return new HTTPRestResponse(statusCode, APPLICATION_JSON, jsonBody); } catch (InvalidProtocolBufferException e) { LOGGER.log(Level.SEVERE, "Failed to serialize response", e); return createErrorResponse(new InternalError("Internal error")); @@ -723,7 +722,7 @@ public HTTPRestResponse createErrorResponse(A2AError error) { private HTTPRestResponse createErrorResponse(int statusCode, A2AError error) { String jsonBody = new HTTPRestErrorResponse(error).toJson(); - return new HTTPRestResponse(statusCode, APPLICATION_A2A_JSON, jsonBody); + return new HTTPRestResponse(statusCode, APPLICATION_JSON, jsonBody); } /** diff --git a/transport/rest/src/test/java/org/a2aproject/sdk/transport/rest/handler/RestHandlerTest.java b/transport/rest/src/test/java/org/a2aproject/sdk/transport/rest/handler/RestHandlerTest.java index cff56a1b4..b170e28ee 100644 --- a/transport/rest/src/test/java/org/a2aproject/sdk/transport/rest/handler/RestHandlerTest.java +++ b/transport/rest/src/test/java/org/a2aproject/sdk/transport/rest/handler/RestHandlerTest.java @@ -1,6 +1,5 @@ package org.a2aproject.sdk.transport.rest.handler; -import static org.a2aproject.sdk.common.MediaType.APPLICATION_A2A_JSON; import static org.a2aproject.sdk.common.MediaType.APPLICATION_JSON; import java.util.Collections; @@ -60,13 +59,13 @@ public void testGetTaskSuccess() { RestHandler.HTTPRestResponse response = handler.getTask(callContext, "", MINIMAL_TASK.id(), 0); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); response = handler.getTask(callContext, "", MINIMAL_TASK.id(), 2); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -99,7 +98,7 @@ public void testListTasksStatusWireString() { null, null, null); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -141,7 +140,7 @@ public void testSendMessage() throws InvalidProtocolBufferException { RestHandler.HTTPRestResponse response = handler.sendMessage(callContext, "", requestBody); Assertions.assertEquals(200, response.getStatusCode(), response.toString()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -176,7 +175,7 @@ public void testSendMessageWrongValueBody() { RestHandler.HTTPRestResponse response = handler.sendMessage(callContext, "", requestBody); Assertions.assertEquals(422, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); JsonObject body = JsonParser.parseString(response.getBody()).getAsJsonObject(); JsonObject error = body.getAsJsonObject("error"); Assertions.assertEquals(422, error.get("code").getAsInt()); @@ -212,7 +211,7 @@ public void testCancelTaskSuccess() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -254,7 +253,7 @@ public void testCancelTaskWithMetadata() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -278,7 +277,7 @@ public void testCancelTaskWithEmptyMetadata() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -298,7 +297,7 @@ public void testCancelTaskWithNoMetadata() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -316,7 +315,7 @@ public void testCancelTaskWithNullBody() { RestHandler.HTTPRestResponse response = handler.cancelTask(callContext, "", null, MINIMAL_TASK.id()); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -391,7 +390,7 @@ public void testPushNotificationConfigSuccess() { RestHandler.HTTPRestResponse response = handler.createTaskPushNotificationConfiguration(callContext, "", requestBody, MINIMAL_TASK.id()); Assertions.assertEquals(201, response.getStatusCode(), response.toString()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -432,11 +431,11 @@ public void testGetPushNotificationConfig() { }""".formatted(MINIMAL_TASK.id()); RestHandler.HTTPRestResponse response = handler.createTaskPushNotificationConfiguration(callContext, "", createRequestBody, MINIMAL_TASK.id()); Assertions.assertEquals(201, response.getStatusCode(), response.toString()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); // Now get it response = handler.getTaskPushNotificationConfiguration(callContext, "", MINIMAL_TASK.id(), "default-config-id"); Assertions.assertEquals(200, response.getStatusCode(), response.toString()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); } @Test @@ -455,7 +454,7 @@ public void testListPushNotificationConfigs() { RestHandler.HTTPRestResponse response = handler.listTaskPushNotificationConfigurations(callContext, "", MINIMAL_TASK.id(), 0, ""); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -784,7 +783,7 @@ public void testRequiredExtensionProvidedSuccess() { // Should succeed without error Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -985,7 +984,7 @@ public void testCompatibleVersionSuccess() { // Should succeed without error Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertNotNull(response.getBody()); } @@ -1071,7 +1070,7 @@ public void testListTasksProtobufEnumStatus() { null, null, null); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -1085,7 +1084,7 @@ public void testListTasksEnumConstantStatus() { null, null, null); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id())); } @@ -1098,7 +1097,7 @@ public void testListTasksEmptyResultIncludesAllFields() { null, null, null); Assertions.assertEquals(200, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); String body = response.getBody(); // Verify all required fields are present (not missing) @@ -1122,7 +1121,7 @@ void constructorDoesNotResolveAgentCardInstances() { private static void assertProblemDetail(RestHandler.HTTPRestResponse response, int expectedStatus, String expectedReason, String expectedMessage) { Assertions.assertEquals(expectedStatus, response.getStatusCode()); - Assertions.assertEquals(APPLICATION_A2A_JSON, response.getContentType()); + Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); JsonObject body = JsonParser.parseString(response.getBody()).getAsJsonObject(); Assertions.assertTrue(body.has("error"), "error wrapper should be present"); JsonObject error = body.getAsJsonObject("error"); @@ -1265,7 +1264,6 @@ public void testExtendedAgentCardWithRouterKnownTenant() { RestHandler.HTTPRestResponse response = handler.getExtendedAgentCard(callContext, "acme"); Assertions.assertEquals(200, response.getStatusCode()); - // The agent card is discovery over plain HTTP, not an A2A protocol response. Assertions.assertEquals(APPLICATION_JSON, response.getContentType()); Assertions.assertTrue(response.getBody().contains("acme-card")); }