11use actix_web:: web:: { Bytes , Data , Payload , Query } ;
2- use actix_web:: {
3- get, post, App , Error , HttpResponse , HttpServer , Result ,
4- } ;
2+ use actix_web:: { get, post, App , Error , HttpResponse , HttpServer , Result } ;
53use futures:: { StreamExt , TryStreamExt } ;
64use mcp_server:: { ByteTransport , Server } ;
75use std:: collections:: HashMap ;
@@ -15,7 +13,6 @@ use tokio::{
1513 io:: { self , AsyncWriteExt } ,
1614 sync:: Mutex ,
1715} ;
18- use tracing_subscriber;
1916mod common;
2017use common:: counter;
2118
@@ -76,12 +73,12 @@ async fn post_event_handler(
7673 return Ok ( HttpResponse :: PayloadTooLarge ( ) . finish ( ) ) ;
7774 }
7875
79- if let Err ( _ ) = write_stream. write_all ( & chunk) . await {
76+ if ( write_stream. write_all ( & chunk) . await ) . is_err ( ) {
8077 return Ok ( HttpResponse :: InternalServerError ( ) . finish ( ) ) ;
8178 }
8279 }
8380
84- if let Err ( _ ) = write_stream. write_u8 ( b'\n' ) . await {
81+ if ( write_stream. write_u8 ( b'\n' ) . await ) . is_err ( ) {
8582 return Ok ( HttpResponse :: InternalServerError ( ) . finish ( ) ) ;
8683 }
8784
@@ -130,7 +127,7 @@ async fn sse_handler(app_state: Data<AppState>) -> Result<HttpResponse, Error> {
130127 . map_ok ( move |bytes| {
131128 let message = match std:: str:: from_utf8 ( & bytes) {
132129 Ok ( message) => format ! ( "event: message\n data: {}\n \n " , message) ,
133- Err ( _) => format ! ( "event: error\n data: Invalid UTF-8 data\n \n " ) ,
130+ Err ( _) => "event: error\n data: Invalid UTF-8 data\n \n " . to_string ( ) ,
134131 } ;
135132 Bytes :: from ( message)
136133 } ) ,
0 commit comments