diff --git a/src/a2a/compat/v0_3/rest_transport.py b/src/a2a/compat/v0_3/rest_transport.py index d48b83a5f..d9b6ff8df 100644 --- a/src/a2a/compat/v0_3/rest_transport.py +++ b/src/a2a/compat/v0_3/rest_transport.py @@ -302,7 +302,8 @@ async def delete_task_push_notification_config( """Deletes the push notification configuration for a specific task.""" await self._execute_request( 'DELETE', - f'/v1/tasks/{request.task_id}/pushNotificationConfigs/{request.id}', + f'/v1/tasks/{_quote_id(request.task_id)}' + f'/pushNotificationConfigs/{_quote_id(request.id)}', context=context, ) diff --git a/tests/compat/v0_3/test_rest_transport.py b/tests/compat/v0_3/test_rest_transport.py index 98006a16d..807d56d70 100644 --- a/tests/compat/v0_3/test_rest_transport.py +++ b/tests/compat/v0_3/test_rest_transport.py @@ -990,3 +990,27 @@ async def test_get_task_does_not_return_task_named_by_id_prefix( # MethodNotFoundError. with pytest.raises(MethodNotFoundError): await transport.get_task(GetTaskRequest(id='t1?x')) + + @pytest.mark.asyncio + async def test_delete_push_config_does_not_delete_config_named_by_prefix( + self, transport: CompatRestTransport + ): + for config_id in ('alerts', 'alerts#ops'): + await transport.create_task_push_notification_config( + TaskPushNotificationConfig( + task_id='t1', + id=config_id, + url='https://hooks.example.com/hook', + ) + ) + + await transport.delete_task_push_notification_config( + DeleteTaskPushNotificationConfigRequest( + task_id='t1', id='alerts#ops' + ) + ) + + response = await transport.list_task_push_notification_configs( + ListTaskPushNotificationConfigsRequest(task_id='t1') + ) + assert [config.id for config in response.configs] == ['alerts']