@@ -4,7 +4,7 @@ use bytes::Bytes;
44use futures:: { StreamExt , future:: BoxFuture } ;
55use http:: { Method , Request , Response , header:: ALLOW } ;
66use http_body:: Body ;
7- use http_body_util:: { BodyExt , Full , combinators:: UnsyncBoxBody } ;
7+ use http_body_util:: { BodyExt , Full , combinators:: BoxBody } ;
88use tokio_stream:: wrappers:: ReceiverStream ;
99
1010use super :: session:: SessionManager ;
@@ -105,7 +105,7 @@ where
105105 fn get_service ( & self ) -> Result < S , std:: io:: Error > {
106106 ( self . service_factory ) ( )
107107 }
108- pub async fn handle < B > ( & self , request : Request < B > ) -> Response < UnsyncBoxBody < Bytes , Infallible > >
108+ pub async fn handle < B > ( & self , request : Request < B > ) -> Response < BoxBody < Bytes , Infallible > >
109109 where
110110 B : Body + Send + ' static ,
111111 B :: Error : Display ,
@@ -120,7 +120,7 @@ where
120120 let response = Response :: builder ( )
121121 . status ( http:: StatusCode :: METHOD_NOT_ALLOWED )
122122 . header ( ALLOW , "GET, POST, DELETE" )
123- . body ( Full :: new ( Bytes :: from ( "Method Not Allowed" ) ) . boxed_unsync ( ) )
123+ . body ( Full :: new ( Bytes :: from ( "Method Not Allowed" ) ) . boxed ( ) )
124124 . expect ( "valid response" ) ;
125125 return response;
126126 }
@@ -148,7 +148,7 @@ where
148148 Full :: new ( Bytes :: from (
149149 "Not Acceptable: Client must accept text/event-stream" ,
150150 ) )
151- . boxed_unsync ( ) ,
151+ . boxed ( ) ,
152152 )
153153 . expect ( "valid response" ) ) ;
154154 }
@@ -162,7 +162,7 @@ where
162162 // unauthorized
163163 return Ok ( Response :: builder ( )
164164 . status ( http:: StatusCode :: UNAUTHORIZED )
165- . body ( Full :: new ( Bytes :: from ( "Unauthorized: Session ID is required" ) ) . boxed_unsync ( ) )
165+ . body ( Full :: new ( Bytes :: from ( "Unauthorized: Session ID is required" ) ) . boxed ( ) )
166166 . expect ( "valid response" ) ) ;
167167 } ;
168168 // check if session exists
@@ -175,7 +175,7 @@ where
175175 // unauthorized
176176 return Ok ( Response :: builder ( )
177177 . status ( http:: StatusCode :: UNAUTHORIZED )
178- . body ( Full :: new ( Bytes :: from ( "Unauthorized: Session not found" ) ) . boxed_unsync ( ) )
178+ . body ( Full :: new ( Bytes :: from ( "Unauthorized: Session not found" ) ) . boxed ( ) )
179179 . expect ( "valid response" ) ) ;
180180 }
181181 // check if last event id is provided
@@ -219,7 +219,7 @@ where
219219 {
220220 return Ok ( Response :: builder ( )
221221 . status ( http:: StatusCode :: NOT_ACCEPTABLE )
222- . body ( Full :: new ( Bytes :: from ( "Not Acceptable: Client must accept both application/json and text/event-stream" ) ) . boxed_unsync ( ) )
222+ . body ( Full :: new ( Bytes :: from ( "Not Acceptable: Client must accept both application/json and text/event-stream" ) ) . boxed ( ) )
223223 . expect ( "valid response" ) ) ;
224224 }
225225
@@ -236,7 +236,7 @@ where
236236 Full :: new ( Bytes :: from (
237237 "Unsupported Media Type: Content-Type must be application/json" ,
238238 ) )
239- . boxed_unsync ( ) ,
239+ . boxed ( ) ,
240240 )
241241 . expect ( "valid response" ) ) ;
242242 }
@@ -265,10 +265,7 @@ where
265265 // unauthorized
266266 return Ok ( Response :: builder ( )
267267 . status ( http:: StatusCode :: UNAUTHORIZED )
268- . body (
269- Full :: new ( Bytes :: from ( "Unauthorized: Session not found" ) )
270- . boxed_unsync ( ) ,
271- )
268+ . body ( Full :: new ( Bytes :: from ( "Unauthorized: Session not found" ) ) . boxed ( ) )
272269 . expect ( "valid response" ) ) ;
273270 }
274271
@@ -307,8 +304,7 @@ where
307304 _ => Ok ( Response :: builder ( )
308305 . status ( http:: StatusCode :: NOT_IMPLEMENTED )
309306 . body (
310- Full :: new ( Bytes :: from ( "Batch requests are not supported yet" ) )
311- . boxed_unsync ( ) ,
307+ Full :: new ( Bytes :: from ( "Batch requests are not supported yet" ) ) . boxed ( ) ,
312308 )
313309 . expect ( "valid response" ) ) ,
314310 }
@@ -415,10 +411,7 @@ where
415411 ClientJsonRpcMessage :: Error ( _json_rpc_error) => Ok ( accepted_response ( ) ) ,
416412 _ => Ok ( Response :: builder ( )
417413 . status ( http:: StatusCode :: NOT_IMPLEMENTED )
418- . body (
419- Full :: new ( Bytes :: from ( "Batch requests are not supported yet" ) )
420- . boxed_unsync ( ) ,
421- )
414+ . body ( Full :: new ( Bytes :: from ( "Batch requests are not supported yet" ) ) . boxed ( ) )
422415 . expect ( "valid response" ) ) ,
423416 }
424417 }
@@ -439,7 +432,7 @@ where
439432 // unauthorized
440433 return Ok ( Response :: builder ( )
441434 . status ( http:: StatusCode :: UNAUTHORIZED )
442- . body ( Full :: new ( Bytes :: from ( "Unauthorized: Session ID is required" ) ) . boxed_unsync ( ) )
435+ . body ( Full :: new ( Bytes :: from ( "Unauthorized: Session ID is required" ) ) . boxed ( ) )
443436 . expect ( "valid response" ) ) ;
444437 } ;
445438 // close session
0 commit comments