Skip to content

Commit c14ec7f

Browse files
authored
fix: Use correct HTTP status code for PushNotificationNotSupportedError (#758)
Fixes #748 🦕
1 parent df907c6 commit c14ec7f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,7 @@ private static int mapErrorToHttpStatus(A2AError error) {
776776
if (error instanceof TaskNotCancelableError) {
777777
return 409;
778778
}
779-
if (error instanceof PushNotificationNotSupportedError
780-
|| error instanceof UnsupportedOperationError) {
779+
if (error instanceof UnsupportedOperationError) {
781780
return 501;
782781
}
783782
if (error instanceof ContentTypeNotSupportedError) {
@@ -788,7 +787,8 @@ private static int mapErrorToHttpStatus(A2AError error) {
788787
}
789788
if (error instanceof ExtendedAgentCardNotConfiguredError
790789
|| error instanceof ExtensionSupportRequiredError
791-
|| error instanceof VersionNotSupportedError) {
790+
|| error instanceof VersionNotSupportedError
791+
|| error instanceof PushNotificationNotSupportedError) {
792792
return 400;
793793
}
794794
if (error instanceof InternalError) {

transport/rest/src/test/java/io/a2a/transport/rest/handler/RestHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public void testPushNotificationConfigNotSupported() {
388388

389389
RestHandler.HTTPRestResponse response = handler.createTaskPushNotificationConfiguration(callContext, "", requestBody, MINIMAL_TASK.id());
390390

391-
assertProblemDetail(response, 501,
391+
assertProblemDetail(response, 400,
392392
"https://a2a-protocol.org/errors/push-notification-not-supported",
393393
"Push Notification is not supported");
394394
}

0 commit comments

Comments
 (0)