fix: do not treat malformed JSON 200 as Accepted for requests (#1208)
* fix: do not treat malformed JSON 200 as Accepted for requests
Streamable HTTP mapped any JSON body that failed to parse as
ServerJsonRpcMessage to Accepted, which is correct for notification
POSTs. For a request the worker then waits on SSE forever, so
call_tool hangs when the server returns 200 application/json with
an empty or non-JSON-RPC body.
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
* fix: include a short body preview in JSON-RPC parse errors
Request POST parse failures now include a 256-byte prefix of the
unusable body so empty, HTML, and `{}` are distinguishable from the
serde diagnostic. HTTP reads bytes() then from_slice, matching Unix.
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
---------
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
This commit is contained in:
parent
b86995aebd
commit
4fa84a5130
1 changed files with 346 additions and 9 deletions
|
|
@ -348,6 +348,15 @@ name = "test_streamable_http_4xx_error_body"
|
|||
required-features = ["transport-streamable-http-client", "transport-streamable-http-client-reqwest"]
|
||||
path = "tests/test_streamable_http_4xx_error_body.rs"
|
||||
|
||||
[[test]]
|
||||
name = "test_streamable_http_malformed_json_request"
|
||||
required-features = [
|
||||
"client",
|
||||
"transport-streamable-http-client",
|
||||
"transport-streamable-http-client-reqwest",
|
||||
]
|
||||
path = "tests/test_streamable_http_malformed_json_request.rs"
|
||||
|
||||
|
||||
[[test]]
|
||||
name = "test_custom_request"
|
||||
|
|
|
|||
Loading…
Reference in a new issue