Commit c4bf139
committed
Client: handle server responses with Content-Length: 0
- When the client sends `notification/initalized`, servers must respond
with HTTP 202 and an empty body. We checked for the absence of a
Content-Type header to verify whether the body was empty.
- However, some servers will send an empty body with a Content-Type
header, and that header may have an unsupported, default type such as
`text/html` or `text/plain`.
- Now we we also use the Content-Length header to check for an empty
body. This header is optional in HTTP/2, so we do not make it our
primary mechanism for detecting empty bodies.
- Fixes #582
Signed-off-by: Daniel Garnier-Moiroux <[email protected]>1 parent 12292ab commit c4bf139
File tree
2 files changed
+9
-4
lines changed- mcp-core/src/main/java/io/modelcontextprotocol/client/transport
- mcp-spring/mcp-spring-webflux/src/main/java/io/modelcontextprotocol/client/transport
2 files changed
+9
-4
lines changedLines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
466 | | - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
467 | 472 | | |
468 | 473 | | |
469 | | - | |
470 | | - | |
| 474 | + | |
471 | 475 | | |
472 | 476 | | |
473 | 477 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
296 | 297 | | |
297 | 298 | | |
298 | | - | |
| 299 | + | |
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
| |||
0 commit comments