@@ -4,7 +4,7 @@ use bytes::Bytes;
4
4
use futures:: { StreamExt , future:: BoxFuture } ;
5
5
use http:: { Method , Request , Response , header:: ALLOW } ;
6
6
use http_body:: Body ;
7
- use http_body_util:: { BodyExt , Full , combinators:: UnsyncBoxBody } ;
7
+ use http_body_util:: { BodyExt , Full , combinators:: BoxBody } ;
8
8
use tokio_stream:: wrappers:: ReceiverStream ;
9
9
10
10
use super :: session:: SessionManager ;
@@ -105,7 +105,7 @@ where
105
105
fn get_service ( & self ) -> Result < S , std:: io:: Error > {
106
106
( self . service_factory ) ( )
107
107
}
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 > >
109
109
where
110
110
B : Body + Send + ' static ,
111
111
B :: Error : Display ,
@@ -120,7 +120,7 @@ where
120
120
let response = Response :: builder ( )
121
121
. status ( http:: StatusCode :: METHOD_NOT_ALLOWED )
122
122
. 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 ( ) )
124
124
. expect ( "valid response" ) ;
125
125
return response;
126
126
}
@@ -148,7 +148,7 @@ where
148
148
Full :: new ( Bytes :: from (
149
149
"Not Acceptable: Client must accept text/event-stream" ,
150
150
) )
151
- . boxed_unsync ( ) ,
151
+ . boxed ( ) ,
152
152
)
153
153
. expect ( "valid response" ) ) ;
154
154
}
@@ -162,7 +162,7 @@ where
162
162
// unauthorized
163
163
return Ok ( Response :: builder ( )
164
164
. 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 ( ) )
166
166
. expect ( "valid response" ) ) ;
167
167
} ;
168
168
// check if session exists
@@ -175,7 +175,7 @@ where
175
175
// unauthorized
176
176
return Ok ( Response :: builder ( )
177
177
. 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 ( ) )
179
179
. expect ( "valid response" ) ) ;
180
180
}
181
181
// check if last event id is provided
@@ -219,7 +219,7 @@ where
219
219
{
220
220
return Ok ( Response :: builder ( )
221
221
. 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 ( ) )
223
223
. expect ( "valid response" ) ) ;
224
224
}
225
225
@@ -236,7 +236,7 @@ where
236
236
Full :: new ( Bytes :: from (
237
237
"Unsupported Media Type: Content-Type must be application/json" ,
238
238
) )
239
- . boxed_unsync ( ) ,
239
+ . boxed ( ) ,
240
240
)
241
241
. expect ( "valid response" ) ) ;
242
242
}
@@ -265,10 +265,7 @@ where
265
265
// unauthorized
266
266
return Ok ( Response :: builder ( )
267
267
. 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 ( ) )
272
269
. expect ( "valid response" ) ) ;
273
270
}
274
271
@@ -307,8 +304,7 @@ where
307
304
_ => Ok ( Response :: builder ( )
308
305
. status ( http:: StatusCode :: NOT_IMPLEMENTED )
309
306
. 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 ( ) ,
312
308
)
313
309
. expect ( "valid response" ) ) ,
314
310
}
@@ -415,10 +411,7 @@ where
415
411
ClientJsonRpcMessage :: Error ( _json_rpc_error) => Ok ( accepted_response ( ) ) ,
416
412
_ => Ok ( Response :: builder ( )
417
413
. 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 ( ) )
422
415
. expect ( "valid response" ) ) ,
423
416
}
424
417
}
@@ -439,7 +432,7 @@ where
439
432
// unauthorized
440
433
return Ok ( Response :: builder ( )
441
434
. 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 ( ) )
443
436
. expect ( "valid response" ) ) ;
444
437
} ;
445
438
// close session
0 commit comments