Commit cc5f47a
fix(main): return explicit error on oversized responses
Address Copilot review feedback:
- Fix comment from "1 MB" to "1 MiB" (1<<20 is a mebibyte)
- Read maxResponseSize+1 bytes and return a clear "response too large"
error instead of silently truncating (which caused confusing JSON
parse errors)
- Extract readResponseBody helper to deduplicate the pattern
- Add tests for readResponseBody (within limit, at limit, exceeds limit)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 55ac4f0 commit cc5f47a
2 files changed
Lines changed: 58 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
272 | 291 | | |
273 | 292 | | |
274 | 293 | | |
| |||
348 | 367 | | |
349 | 368 | | |
350 | 369 | | |
351 | | - | |
| 370 | + | |
352 | 371 | | |
353 | 372 | | |
354 | 373 | | |
| |||
412 | 431 | | |
413 | 432 | | |
414 | 433 | | |
415 | | - | |
| 434 | + | |
416 | 435 | | |
417 | 436 | | |
418 | 437 | | |
| |||
479 | 498 | | |
480 | 499 | | |
481 | 500 | | |
482 | | - | |
| 501 | + | |
483 | 502 | | |
484 | 503 | | |
485 | 504 | | |
| |||
538 | 557 | | |
539 | 558 | | |
540 | 559 | | |
541 | | - | |
| 560 | + | |
542 | 561 | | |
543 | 562 | | |
544 | 563 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
276 | 278 | | |
277 | 279 | | |
278 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
279 | 313 | | |
280 | 314 | | |
281 | 315 | | |
| |||
0 commit comments