Skip to content

Commit a66f66a

Browse files
authored
fix: error for status in post method of streamable http client (#238)
1 parent 969fad2 commit a66f66a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

crates/rmcp/src/transport/common/reqwest/streamable_http_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl StreamableHttpClient for reqwest::Client {
9595
if let Some(session_id) = session_id {
9696
request = request.header(HEADER_SESSION_ID, session_id.as_ref());
9797
}
98-
let response = request.json(&message).send().await?;
98+
let response = request.json(&message).send().await?.error_for_status()?;
9999
if response.status() == reqwest::StatusCode::ACCEPTED {
100100
return Ok(StreamableHttpPostResponse::Accepted);
101101
}

examples/clients/src/streamable_http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async fn main() -> Result<()> {
1616
)
1717
.with(tracing_subscriber::fmt::layer())
1818
.init();
19-
let transport = StreamableHttpClientTransport::from_uri("http://localhost:8000");
19+
let transport = StreamableHttpClientTransport::from_uri("http://localhost:8000/mcp");
2020
let client_info = ClientInfo {
2121
protocol_version: Default::default(),
2222
capabilities: ClientCapabilities::default(),

0 commit comments

Comments
 (0)