fix: error for status in post method of streamable http client (#238)
This commit is contained in:
parent
969fad26cc
commit
a66f66ae34
2 changed files with 2 additions and 2 deletions
|
|
@ -95,7 +95,7 @@ impl StreamableHttpClient for reqwest::Client {
|
||||||
if let Some(session_id) = session_id {
|
if let Some(session_id) = session_id {
|
||||||
request = request.header(HEADER_SESSION_ID, session_id.as_ref());
|
request = request.header(HEADER_SESSION_ID, session_id.as_ref());
|
||||||
}
|
}
|
||||||
let response = request.json(&message).send().await?;
|
let response = request.json(&message).send().await?.error_for_status()?;
|
||||||
if response.status() == reqwest::StatusCode::ACCEPTED {
|
if response.status() == reqwest::StatusCode::ACCEPTED {
|
||||||
return Ok(StreamableHttpPostResponse::Accepted);
|
return Ok(StreamableHttpPostResponse::Accepted);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ async fn main() -> Result<()> {
|
||||||
)
|
)
|
||||||
.with(tracing_subscriber::fmt::layer())
|
.with(tracing_subscriber::fmt::layer())
|
||||||
.init();
|
.init();
|
||||||
let transport = StreamableHttpClientTransport::from_uri("http://localhost:8000");
|
let transport = StreamableHttpClientTransport::from_uri("http://localhost:8000/mcp");
|
||||||
let client_info = ClientInfo {
|
let client_info = ClientInfo {
|
||||||
protocol_version: Default::default(),
|
protocol_version: Default::default(),
|
||||||
capabilities: ClientCapabilities::default(),
|
capabilities: ClientCapabilities::default(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue