Commit 8eba015
Guard against empty webhook update, verify PUT body on wire
Two fresh-eyes findings on #1806:
1. `WebhookRequest.update_req` used to happily serialize
`<tsRequest><webhook/></tsRequest>` when every updatable field on the
WebhookItem was None. The server rejected that with a generic 400 the
caller couldn't act on. Now raises ValueError up front with a message
naming the four fields that would resolve it.
2. `test_update` verified the response-derived WebhookItem but never
inspected the PUT body, so removing the `update_req` call in the
endpoint would keep the test green. Added `m.last_request` assertions
on the wire: name, isEnabled, url, and event tag all present in the
PUT payload. This is the load-bearing endpoint<->factory contract check.
Also added test_update_rejects_empty_payload confirming the new guard
fires when nothing is set on the item.
28 passed on test_webhook.py.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c2a4c1f commit 8eba015
2 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1414 | 1414 | | |
1415 | 1415 | | |
1416 | 1416 | | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
1417 | 1432 | | |
1418 | 1433 | | |
1419 | 1434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
200 | 213 | | |
201 | 214 | | |
202 | 215 | | |
| |||
210 | 223 | | |
211 | 224 | | |
212 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
213 | 239 | | |
214 | 240 | | |
215 | 241 | | |
| |||
0 commit comments