Skip to content

Commit 82d64b7

Browse files
committed
fix: actix-web test attribute and add NormalizePath middleware
- Use #[actix_web::test] instead of #[tokio::test] for actix-web tests - Add NormalizePath middleware to actix-web SSE server for consistent path handling
1 parent 380ec9f commit 82d64b7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

crates/rmcp/src/transport/sse_server/actix_impl.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::{collections::HashMap, io, sync::Arc, time::Duration};
33
use actix_web::{
44
HttpRequest, HttpResponse, Result, Scope,
55
error::ErrorInternalServerError,
6+
middleware,
67
web::{self, Bytes, Data, Json, Query},
78
};
89
use futures::{Sink, SinkExt, Stream, StreamExt};
@@ -278,6 +279,7 @@ impl SseServer {
278279
let server = actix_web::HttpServer::new(move || {
279280
actix_web::App::new()
280281
.app_data(app_data.clone())
282+
.wrap(middleware::NormalizePath::trim())
281283
.route(&sse_path, web::get().to(sse_handler))
282284
.route(&post_path, web::post().to(post_event_handler))
283285
})

crates/rmcp/tests/test_with_python.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async fn test_with_python_client_axum() -> anyhow::Result<()> {
6262
}
6363

6464
#[cfg(feature = "actix-web")]
65-
#[tokio::test]
65+
#[actix_web::test]
6666
async fn test_with_python_client_actix() -> anyhow::Result<()> {
6767
init().await?;
6868

0 commit comments

Comments
 (0)