a2aproject / a2aproject/a2a-js
[Bug]: REST create push config ignores path taskId
- 主要语言
- TypeScript
- 星标
- 613
- 派生
- 169
- 平均合并
- 1 天 6 小时
- 30 天内合并 PR
- 21
描述
### What happened?
`POST /tasks/:taskId/pushNotificationConfigs` parses only the JSON body (`TaskPushNotificationConfig.fromJSON(req.body)`). `req.params.taskId` is never copied onto the config. `fromJSON` defaults a missing taskId to `""`, and after #629 empty IDs are `RequestMalformedError`.
The proto HTTP mapping is `post: "/tasks/{task_id=*}/pushNotificationConfigs"` with `body: "*"`, so transcoding clients put task_id in the URL and may omit it from the body. Same-SDK RestTransport sends taskId in both places, which is why in-repo tests pass. The v0.3 Express handler has the same hole.
**Repro**
Create a task, then `POST /tasks//pushNotificationConfigs` with body `{ "url": "https://example.test/hook" }` and no taskId field.
Observed: 400 "Task ID is required".
Expected: 201 and a stored config whose taskId is the path id.
### Relevant log output
n/a.
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
贡献指南
调研方向
Look at the REST handler for creating push notification configs, likely in a file like `src/rest/tasks.ts` or similar. The bug is that `req.params.taskId` is not being used to set the `taskId` on the config object when `TaskPushNotificationConfig.fromJSON(req.body)` is called. Find the `fromJSON` method to see its defaults. Write a test that reproduces the issue by sending a POST request with a taskId in the URL but not in the body, and verify the config is created with the correct taskId. Check the v0.3 Express handler as mentioned.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- express, javascript, node.js, typescript
- 领域
- api, backend
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 75/100