diff --git a/common/src/main/java/io/a2a/common/MediaType.java b/common/src/main/java/io/a2a/common/MediaType.java
index 9c7027f60..9cdc48211 100644
--- a/common/src/main/java/io/a2a/common/MediaType.java
+++ b/common/src/main/java/io/a2a/common/MediaType.java
@@ -2,6 +2,5 @@
public interface MediaType {
- public static final String APPLICATION_JSON = "application/json";
- public static final String APPLICATION_PROBLEM_JSON = "application/problem+json";
+ String APPLICATION_JSON = "application/json";
}
diff --git a/reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java b/reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java
index 56fd4dea9..7ca65cb35 100644
--- a/reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java
+++ b/reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java
@@ -1,6 +1,5 @@
package io.a2a.server.apps.quarkus;
-import static io.a2a.common.MediaType.APPLICATION_PROBLEM_JSON;
import static io.a2a.server.ServerCallContext.TRANSPORT_KEY;
import static io.a2a.transport.jsonrpc.context.JSONRPCContextKeys.HEADERS_KEY;
import static io.a2a.transport.jsonrpc.context.JSONRPCContextKeys.METHOD_NAME_KEY;
@@ -248,7 +247,7 @@ public class A2AServerRoutes {
*
*
Processing Flow:
*
- * - Parse JSON-RPC request body using {@link JSONRPCUtils#parseRequestBody}
+ * - Parse JSON-RPC request body using {@link JSONRPCUtils#parseRequestBody(String, String)}
* - Create {@link ServerCallContext} from routing context
* - Route to streaming or non-streaming handler
* - Handle errors with appropriate JSON-RPC error codes
@@ -297,7 +296,7 @@ public void invokeJSONRPCHandler(@Body String body, RoutingContext rc) {
if (error != null) {
rc.response()
.setStatusCode(200)
- .putHeader(CONTENT_TYPE, APPLICATION_PROBLEM_JSON)
+ .putHeader(CONTENT_TYPE, APPLICATION_JSON)
.end(serializeResponse(error));
} else if (streaming) {
final Multi extends A2AResponse>> finalStreamingResponse = streamingResponse;
@@ -313,7 +312,7 @@ public void invokeJSONRPCHandler(@Body String body, RoutingContext rc) {
} else {
rc.response()
.setStatusCode(200)
- .putHeader(CONTENT_TYPE, nonStreamingResponse.getError() != null ? APPLICATION_PROBLEM_JSON : APPLICATION_JSON)
+ .putHeader(CONTENT_TYPE, APPLICATION_JSON)
.end(serializeResponse(nonStreamingResponse));
}
}
diff --git a/reference/jsonrpc/src/test/java/io/a2a/server/apps/quarkus/A2AServerRoutesTest.java b/reference/jsonrpc/src/test/java/io/a2a/server/apps/quarkus/A2AServerRoutesTest.java
index ab1566308..bc1b717e5 100644
--- a/reference/jsonrpc/src/test/java/io/a2a/server/apps/quarkus/A2AServerRoutesTest.java
+++ b/reference/jsonrpc/src/test/java/io/a2a/server/apps/quarkus/A2AServerRoutesTest.java
@@ -1,6 +1,5 @@
package io.a2a.server.apps.quarkus;
-import static io.a2a.common.MediaType.APPLICATION_PROBLEM_JSON;
import static io.a2a.spec.A2AMethods.DELETE_TASK_PUSH_NOTIFICATION_CONFIG_METHOD;
import static io.a2a.spec.A2AMethods.GET_TASK_METHOD;
import static io.a2a.spec.A2AMethods.GET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD;
@@ -718,7 +717,7 @@ public void testTenantExtraction_StreamingRequest() {
}
@Test
- public void testJsonParseError_ContentTypeIsProblemJson() {
+ public void testJsonParseError_ContentTypeIsApplicationJson() {
// Arrange - invalid JSON
String invalidJson = "not valid json {{{";
when(mockRequestBody.asString()).thenReturn(invalidJson);
@@ -727,11 +726,11 @@ public void testJsonParseError_ContentTypeIsProblemJson() {
routes.invokeJSONRPCHandler(invalidJson, mockRoutingContext);
// Assert
- verify(mockHttpResponse).putHeader(CONTENT_TYPE, APPLICATION_PROBLEM_JSON);
+ verify(mockHttpResponse).putHeader(CONTENT_TYPE, APPLICATION_JSON);
}
@Test
- public void testMethodNotFound_ContentTypeIsProblemJson() {
+ public void testMethodNotFound_ContentTypeIsApplicationJson() {
// Arrange - unknown method
String jsonRpcRequest = """
{
@@ -746,7 +745,7 @@ public void testMethodNotFound_ContentTypeIsProblemJson() {
routes.invokeJSONRPCHandler(jsonRpcRequest, mockRoutingContext);
// Assert
- verify(mockHttpResponse).putHeader(CONTENT_TYPE, APPLICATION_PROBLEM_JSON);
+ verify(mockHttpResponse).putHeader(CONTENT_TYPE, APPLICATION_JSON);
}
/**
diff --git a/reference/rest/src/test/java/io/a2a/server/rest/quarkus/A2AServerRoutesTest.java b/reference/rest/src/test/java/io/a2a/server/rest/quarkus/A2AServerRoutesTest.java
index 09a45c828..968c93ef0 100644
--- a/reference/rest/src/test/java/io/a2a/server/rest/quarkus/A2AServerRoutesTest.java
+++ b/reference/rest/src/test/java/io/a2a/server/rest/quarkus/A2AServerRoutesTest.java
@@ -1,5 +1,6 @@
package io.a2a.server.rest.quarkus;
+import static io.a2a.common.MediaType.APPLICATION_JSON;
import static io.a2a.spec.A2AMethods.CANCEL_TASK_METHOD;
import static io.a2a.spec.A2AMethods.DELETE_TASK_PUSH_NOTIFICATION_CONFIG_METHOD;
import static io.a2a.spec.A2AMethods.GET_TASK_METHOD;
@@ -82,7 +83,7 @@ public void setUp() {
when(mockRoutingContext.user()).thenReturn(null);
when(mockRequest.headers()).thenReturn(mockHeaders);
when(mockRequest.params()).thenReturn(mockParams);
- when(mockRequest.getHeader(any(CharSequence.class))).thenReturn("application/json");
+ when(mockRequest.getHeader(any(CharSequence.class))).thenReturn(APPLICATION_JSON);
when(mockRoutingContext.body()).thenReturn(mockRequestBody);
when(mockRequestBody.asString()).thenReturn("{}");
when(mockResponse.setStatusCode(any(Integer.class))).thenReturn(mockResponse);
@@ -96,7 +97,7 @@ public void testSendMessage_MethodNameSetInContext() {
// Arrange
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{}");
when(mockRestHandler.sendMessage(any(ServerCallContext.class), anyString(), anyString())).thenReturn(mockHttpResponse);
@@ -117,7 +118,7 @@ public void testSendMessageStreaming_MethodNameSetInContext() {
// Arrange
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{}");
when(mockRestHandler.sendStreamingMessage(any(ServerCallContext.class), anyString(), anyString()))
.thenReturn(mockHttpResponse);
@@ -140,7 +141,7 @@ public void testGetTask_MethodNameSetInContext() {
when(mockRoutingContext.pathParam("taskId")).thenReturn("task123");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{test:value}");
when(mockRestHandler.getTask(any(ServerCallContext.class), anyString(), anyString(), any())).thenReturn(mockHttpResponse);
@@ -162,7 +163,7 @@ public void testCancelTask_MethodNameSetInContext() {
when(mockRoutingContext.pathParam("taskId")).thenReturn("task123");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{}");
when(mockRestHandler.cancelTask(any(ServerCallContext.class), anyString(), anyString(), anyString())).thenReturn(mockHttpResponse);
@@ -184,7 +185,7 @@ public void testCancelTask_WithMetadata() {
when(mockRoutingContext.pathParam("taskId")).thenReturn("task456");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{\"id\":\"task456\",\"status\":\"cancelled\"}");
String requestBody = """
@@ -217,7 +218,7 @@ public void testCancelTask_WithEmptyMetadata() {
when(mockRoutingContext.pathParam("taskId")).thenReturn("task789");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{\"id\":\"task789\"}");
String requestBody = """
@@ -246,7 +247,7 @@ public void testCancelTask_WithNoMetadataField() {
when(mockRoutingContext.pathParam("taskId")).thenReturn("task999");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{\"id\":\"task999\"}");
String requestBody = "{}";
@@ -271,7 +272,7 @@ public void testCancelTask_WithNullBody() {
when(mockRoutingContext.pathParam("taskId")).thenReturn("task111");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{\"id\":\"task111\"}");
ArgumentCaptor bodyCaptor = ArgumentCaptor.forClass(String.class);
@@ -293,7 +294,7 @@ public void testCancelTask_WithComplexMetadata() {
when(mockRoutingContext.pathParam("taskId")).thenReturn("task222");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{\"id\":\"task222\"}");
String requestBody = """
@@ -331,7 +332,7 @@ public void testSubscribeTask_MethodNameSetInContext() {
when(mockRoutingContext.pathParam("taskId")).thenReturn("task123");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{}");
when(mockRestHandler.subscribeToTask(any(ServerCallContext.class), anyString(), anyString()))
.thenReturn(mockHttpResponse);
@@ -354,7 +355,7 @@ public void testCreateTaskPushNotificationConfiguration_MethodNameSetInContext()
when(mockRoutingContext.pathParam("taskId")).thenReturn("task123");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{}");
when(mockRestHandler.createTaskPushNotificationConfiguration(any(ServerCallContext.class), anyString(), anyString(), anyString())).thenReturn(mockHttpResponse);
@@ -377,7 +378,7 @@ public void testGetTaskPushNotificationConfiguration_MethodNameSetInContext() {
when(mockRoutingContext.pathParam("configId")).thenReturn("config456");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{}");
when(mockRestHandler.getTaskPushNotificationConfiguration(any(ServerCallContext.class), anyString(), anyString(), anyString())).thenReturn(mockHttpResponse);
@@ -400,7 +401,7 @@ public void testListTaskPushNotificationConfigurations_MethodNameSetInContext()
when(mockRoutingContext.pathParam("taskId")).thenReturn("task123");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{}");
when(mockRestHandler.listTaskPushNotificationConfigurations(any(ServerCallContext.class), anyString(), anyString(), anyInt(), anyString()))
.thenReturn(mockHttpResponse);
@@ -424,7 +425,7 @@ public void testDeleteTaskPushNotificationConfiguration_MethodNameSetInContext()
when(mockRoutingContext.pathParam("configId")).thenReturn("config456");
HTTPRestResponse mockHttpResponse = mock(HTTPRestResponse.class);
when(mockHttpResponse.getStatusCode()).thenReturn(200);
- when(mockHttpResponse.getContentType()).thenReturn("application/json");
+ when(mockHttpResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockHttpResponse.getBody()).thenReturn("{}");
when(mockRestHandler.deleteTaskPushNotificationConfiguration(any(ServerCallContext.class), anyString(), anyString(), anyString())).thenReturn(mockHttpResponse);
@@ -446,7 +447,7 @@ public void testSendMessage_UnsupportedContentType_ReturnsContentTypeNotSupporte
// Arrange
HTTPRestResponse mockErrorResponse = mock(HTTPRestResponse.class);
when(mockErrorResponse.getStatusCode()).thenReturn(415);
- when(mockErrorResponse.getContentType()).thenReturn("application/problem+json");
+ when(mockErrorResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockErrorResponse.getBody()).thenReturn("{\"error\":{\"code\":415,\"status\":\"INVALID_ARGUMENT\",\"message\":\"Incompatible content types\",\"details\":[{\"reason\":\"CONTENT_TYPE_NOT_SUPPORTED\",\"domain\":\"a2a-protocol.org\"}]}}");
when(mockRestHandler.createErrorResponse(any(ContentTypeNotSupportedError.class))).thenReturn(mockErrorResponse);
when(mockRequest.getHeader(any(CharSequence.class))).thenReturn("text/plain");
@@ -464,7 +465,7 @@ public void testSendMessageStreaming_UnsupportedContentType_ReturnsContentTypeNo
// Arrange
HTTPRestResponse mockErrorResponse = mock(HTTPRestResponse.class);
when(mockErrorResponse.getStatusCode()).thenReturn(415);
- when(mockErrorResponse.getContentType()).thenReturn("application/problem+json");
+ when(mockErrorResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockErrorResponse.getBody()).thenReturn("{\"error\":{\"code\":415,\"status\":\"INVALID_ARGUMENT\",\"message\":\"Incompatible content types\",\"details\":[{\"reason\":\"CONTENT_TYPE_NOT_SUPPORTED\",\"domain\":\"a2a-protocol.org\"}]}}");
when(mockRestHandler.createErrorResponse(any(ContentTypeNotSupportedError.class))).thenReturn(mockErrorResponse);
when(mockRequest.getHeader(any(CharSequence.class))).thenReturn("text/plain");
@@ -482,9 +483,9 @@ public void testSendMessage_UnsupportedProtocolVersion_ReturnsVersionNotSupporte
// Arrange: content type is OK, but RestHandler returns a VersionNotSupportedError response
HTTPRestResponse mockErrorResponse = mock(HTTPRestResponse.class);
when(mockErrorResponse.getStatusCode()).thenReturn(400);
- when(mockErrorResponse.getContentType()).thenReturn("application/problem+json");
+ when(mockErrorResponse.getContentType()).thenReturn(APPLICATION_JSON);
when(mockErrorResponse.getBody()).thenReturn("{\"error\":{\"code\":400,\"status\":\"UNIMPLEMENTED\",\"message\":\"Protocol version not supported\",\"details\":[{\"reason\":\"VERSION_NOT_SUPPORTED\",\"domain\":\"a2a-protocol.org\"}]}}");
- when(mockRequest.getHeader(any(CharSequence.class))).thenReturn("application/json");
+ when(mockRequest.getHeader(any(CharSequence.class))).thenReturn(APPLICATION_JSON);
when(mockRestHandler.sendMessage(any(ServerCallContext.class), anyString(), anyString()))
.thenReturn(mockErrorResponse);
diff --git a/transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java b/transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java
index ef4a95f42..ea16f3aa4 100644
--- a/transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java
+++ b/transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java
@@ -1,7 +1,6 @@
package io.a2a.transport.rest.handler;
import static io.a2a.common.MediaType.APPLICATION_JSON;
-import static io.a2a.common.MediaType.APPLICATION_PROBLEM_JSON;
import static io.a2a.server.util.async.AsyncUtils.createTubeConfig;
import io.a2a.spec.A2AErrorCodes;
@@ -683,7 +682,7 @@ public HTTPRestResponse createErrorResponse(A2AError error) {
private HTTPRestResponse createErrorResponse(int statusCode, A2AError error) {
String jsonBody = new HTTPRestErrorResponse(error).toJson();
- return new HTTPRestResponse(statusCode, APPLICATION_PROBLEM_JSON, jsonBody);
+ return new HTTPRestResponse(statusCode, APPLICATION_JSON, jsonBody);
}
private HTTPRestStreamingResponse createStreamingResponse(Flow.Publisher publisher) {
diff --git a/transport/rest/src/test/java/io/a2a/transport/rest/handler/RestHandlerTest.java b/transport/rest/src/test/java/io/a2a/transport/rest/handler/RestHandlerTest.java
index e71dd6169..f5184b2f4 100644
--- a/transport/rest/src/test/java/io/a2a/transport/rest/handler/RestHandlerTest.java
+++ b/transport/rest/src/test/java/io/a2a/transport/rest/handler/RestHandlerTest.java
@@ -1,6 +1,8 @@
package io.a2a.transport.rest.handler;
+import static io.a2a.common.MediaType.APPLICATION_JSON;
+
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -14,6 +16,8 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.protobuf.InvalidProtocolBufferException;
+
+import io.a2a.common.MediaType;
import io.a2a.server.AgentCardCacheMetadata;
import io.a2a.server.ServerCallContext;
import io.a2a.server.auth.UnauthenticatedUser;
@@ -49,13 +53,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_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_JSON, response.getContentType());
Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id()));
}
@@ -88,7 +92,7 @@ public void testListTasksStatusWireString() {
null, null, null);
Assertions.assertEquals(200, response.getStatusCode());
- Assertions.assertEquals("application/json", response.getContentType());
+ Assertions.assertEquals(APPLICATION_JSON, response.getContentType());
Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id()));
}
@@ -130,7 +134,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_JSON, response.getContentType());
Assertions.assertNotNull(response.getBody());
}
@@ -165,7 +169,7 @@ public void testSendMessageWrongValueBody() {
RestHandler.HTTPRestResponse response = handler.sendMessage(callContext, "", requestBody);
Assertions.assertEquals(422, response.getStatusCode());
- Assertions.assertEquals("application/problem+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());
@@ -201,7 +205,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_JSON, response.getContentType());
Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id()));
}
@@ -243,7 +247,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_JSON, response.getContentType());
Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id()));
}
@@ -267,7 +271,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_JSON, response.getContentType());
Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id()));
}
@@ -287,7 +291,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_JSON, response.getContentType());
Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id()));
}
@@ -305,7 +309,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_JSON, response.getContentType());
Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id()));
}
@@ -380,7 +384,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_JSON, response.getContentType());
Assertions.assertNotNull(response.getBody());
}
@@ -421,11 +425,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_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_JSON, response.getContentType());
}
@Test
@@ -444,7 +448,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_JSON, response.getContentType());
Assertions.assertNotNull(response.getBody());
}
@@ -745,7 +749,7 @@ public void testRequiredExtensionProvidedSuccess() {
// Should succeed without error
Assertions.assertEquals(200, response.getStatusCode());
- Assertions.assertEquals("application/json", response.getContentType());
+ Assertions.assertEquals(APPLICATION_JSON, response.getContentType());
Assertions.assertNotNull(response.getBody());
}
@@ -946,7 +950,7 @@ public void testCompatibleVersionSuccess() {
// Should succeed without error
Assertions.assertEquals(200, response.getStatusCode());
- Assertions.assertEquals("application/json", response.getContentType());
+ Assertions.assertEquals(APPLICATION_JSON, response.getContentType());
Assertions.assertNotNull(response.getBody());
}
@@ -994,7 +998,7 @@ public void testNoVersionDefaultsToCurrentVersionSuccess() {
// Should succeed without error (defaults to 1.0)
Assertions.assertEquals(200, response.getStatusCode());
- Assertions.assertEquals("application/json", response.getContentType());
+ Assertions.assertEquals(APPLICATION_JSON, response.getContentType());
Assertions.assertNotNull(response.getBody());
}
@@ -1029,7 +1033,7 @@ public void testListTasksProtobufEnumStatus() {
null, null, null);
Assertions.assertEquals(200, response.getStatusCode());
- Assertions.assertEquals("application/json", response.getContentType());
+ Assertions.assertEquals(APPLICATION_JSON, response.getContentType());
Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id()));
}
@@ -1043,7 +1047,7 @@ public void testListTasksEnumConstantStatus() {
null, null, null);
Assertions.assertEquals(200, response.getStatusCode());
- Assertions.assertEquals("application/json", response.getContentType());
+ Assertions.assertEquals(APPLICATION_JSON, response.getContentType());
Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.id()));
}
@@ -1056,7 +1060,7 @@ public void testListTasksEmptyResultIncludesAllFields() {
null, null, null);
Assertions.assertEquals(200, response.getStatusCode());
- Assertions.assertEquals("application/json", response.getContentType());
+ Assertions.assertEquals(APPLICATION_JSON, response.getContentType());
String body = response.getBody();
// Verify all required fields are present (not missing)
@@ -1072,7 +1076,7 @@ public void testListTasksEmptyResultIncludesAllFields() {
private static void assertProblemDetail(RestHandler.HTTPRestResponse response,
int expectedStatus, String expectedReason, String expectedMessage) {
Assertions.assertEquals(expectedStatus, response.getStatusCode());
- Assertions.assertEquals("application/problem+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");