mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-29 00:00:18 +02:00
Reduce size of response body types (#11)
Wrapping everything in `crate::body::Either` wasn't actually necessary ans probably causes large body types. You can instead box the bodies in the leaf services.
This commit is contained in:
+5
-2
@@ -15,7 +15,10 @@
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
use crate::{routing::EmptyRouter, service::OnMethod};
|
||||
use crate::{
|
||||
routing::EmptyRouter,
|
||||
service::{BoxResponseBody, OnMethod},
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use future::ResponseFuture;
|
||||
use futures_util::{sink::SinkExt, stream::StreamExt};
|
||||
@@ -38,7 +41,7 @@ pub mod future;
|
||||
/// each connection.
|
||||
///
|
||||
/// See the [module docs](crate::ws) for more details.
|
||||
pub fn ws<F, Fut>(callback: F) -> OnMethod<WebSocketUpgrade<F>, EmptyRouter>
|
||||
pub fn ws<F, Fut>(callback: F) -> OnMethod<BoxResponseBody<WebSocketUpgrade<F>>, EmptyRouter>
|
||||
where
|
||||
F: FnOnce(WebSocket) -> Fut + Clone + Send + 'static,
|
||||
Fut: Future<Output = ()> + Send + 'static,
|
||||
|
||||
Reference in New Issue
Block a user