Commit 3e863ee
fix(client): validate Content-Type on GET/resume SSE responses
The standalone-GET and resume paths (_startOrAuthSse) piped the response
body into the SSE parser without checking Content-Type, while the POST
path already validates it via mediaTypeEssence and throws
ClientHttpUnexpectedContent. A proxy/captive-portal/misconfigured server
answering the GET with 200 and a non-SSE body (e.g. text/html) was
therefore silently swallowed: the parser yielded no events, onerror never
fired, and the caller believed it had a live stream.
Apply the same content-type check on the GET path and throw
ClientHttpUnexpectedContent when the media type is not text/event-stream,
matching the Streamable HTTP spec (GET returns text/event-stream or 405).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N6RtoHuxrDqTUo9Mw9h4Cv1 parent f130e1a commit 3e863ee
3 files changed
Lines changed: 43 additions & 0 deletions
File tree
- .changeset
- packages/client
- src/client
- test/client
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
603 | 616 | | |
604 | 617 | | |
605 | 618 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
433 | 458 | | |
434 | 459 | | |
435 | 460 | | |
| |||
0 commit comments