diff --git a/server-common/src/main/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandler.java b/server-common/src/main/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandler.java index ebda76a1c..72a795757 100644 --- a/server-common/src/main/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandler.java +++ b/server-common/src/main/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandler.java @@ -1157,7 +1157,6 @@ public TaskPushNotificationConfig onCreateTaskPushNotificationConfig( public TaskPushNotificationConfig onGetTaskPushNotificationConfig( GetTaskPushNotificationConfigParams params, ServerCallContext context) throws A2AError { validateRequiredId(context, "taskId", params.taskId()); - validateRequiredId(context, "id", params.id()); if (pushConfigStore == null) { throw new UnsupportedOperationError(); } @@ -1173,8 +1172,9 @@ public TaskPushNotificationConfig onGetTaskPushNotificationConfig( } String requestedConfigId = params.id(); - String configId = Assert.isNullOrEmpty(requestedConfigId) ? params.taskId() - : Assert.checkNotNullParam("requestedConfigId", requestedConfigId); + String configId = requestedConfigId == null || requestedConfigId.isBlank() + ? params.taskId() + : requestedConfigId; return getTaskPushNotificationConfig(listTaskPushNotificationConfigsResult, configId); } diff --git a/server-common/src/test/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandlerBuilderAuthorizationTest.java b/server-common/src/test/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandlerBuilderAuthorizationTest.java index e8002f4c4..759b84774 100644 --- a/server-common/src/test/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandlerBuilderAuthorizationTest.java +++ b/server-common/src/test/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandlerBuilderAuthorizationTest.java @@ -114,7 +114,6 @@ void tearDown() { "subscribe, ''", "subscribe, ' '", "createPush, ''", "createPush, ' '", "getPush, ''", "getPush, ' '", - "getPushId, ''", "getPushId, ' '", "listPush, ''", "listPush, ' '", "deletePush, ''", "deletePush, ' '", "deletePushId, ''", "deletePushId, ' '" diff --git a/server-common/src/test/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandlerTest.java b/server-common/src/test/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandlerTest.java index 66340fd0f..cb20bdcf2 100644 --- a/server-common/src/test/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandlerTest.java +++ b/server-common/src/test/java/org/a2aproject/sdk/server/requesthandlers/DefaultRequestHandlerTest.java @@ -79,6 +79,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.NullAndEmptySource; +import org.junit.jupiter.params.provider.ValueSource; /** * Integration tests for DefaultRequestHandler focusing on AUTH_REQUIRED workflow. @@ -1222,6 +1223,30 @@ void testGetTaskPushNotificationConfigDefaultsMissingIdToTaskId() throws Excepti assertEquals("http://example.com/get-default-config-id", result.url()); } + @ParameterizedTest + @NullAndEmptySource + @ValueSource(strings = " ") + void testGetTaskPushNotificationConfigDefaultsBlankIdToTaskIdWithEffectiveCard(String configId) + throws Exception { + String taskId = "get-default-config-id-with-card"; + taskStore.save(Task.builder() + .id(taskId) + .contextId("ctx-get-default-config-id-with-card") + .status(new TaskStatus(TaskState.TASK_STATE_WORKING)) + .build(), false); + requestHandler.onCreateTaskPushNotificationConfig(TaskPushNotificationConfig.builder() + .taskId(taskId) + .url("http://example.com/get-default-config-id-with-card") + .build(), NULL_CONTEXT); + + TaskPushNotificationConfig result = requestHandler.onGetTaskPushNotificationConfig( + new GetTaskPushNotificationConfigParams(taskId, configId), + configId == null || configId.isBlank() ? NULL_CONTEXT : contextWithEffectiveCard(true)); + + assertEquals(taskId, result.id()); + assertEquals("http://example.com/get-default-config-id-with-card", result.url()); + } + /** * Verify that onMessageSend stores the protocol version when the request * includes a push notification config (new task path).