Skip to content

Commit 1fee4ef

Browse files
kabirclaude
authored andcommitted
fix: Extract taskId from URL path in HTTP+JSON CreateTaskPushNotifica… (a2aproject#734)
…tionConfig Per HTTP+JSON spec with body: "*", taskId should be extracted from the URL path /tasks/{taskId}/pushNotificationConfigs, not required in request body. Fixes a2aproject#732 --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 2604c78 commit 1fee4ef

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,14 @@ public HTTPRestResponse createTaskPushNotificationConfiguration(ServerCallContex
351351
}
352352
io.a2a.grpc.TaskPushNotificationConfig.Builder builder = io.a2a.grpc.TaskPushNotificationConfig.newBuilder();
353353
parseRequestBody(body, builder);
354+
355+
String taskIdFromBody = builder.getTaskId();
356+
if (!taskIdFromBody.isEmpty() && !taskIdFromBody.equals(taskId)) {
357+
throw new InvalidParamsError("Task ID in request body (" + taskIdFromBody + ") does not match task ID in URL path (" + taskId + ").");
358+
}
359+
354360
builder.setTenant(tenant);
361+
builder.setTaskId(taskId);
355362
TaskPushNotificationConfig result = requestHandler.onCreateTaskPushNotificationConfig(ProtoUtils.FromProto.createTaskPushNotificationConfig(builder), context);
356363
return createSuccessResponse(201, io.a2a.grpc.TaskPushNotificationConfig.newBuilder(ProtoUtils.ToProto.taskPushNotificationConfig(result)));
357364
} catch (A2AError e) {

0 commit comments

Comments
 (0)