feat: add compression layer
This commit is contained in:
parent
1203a34f8f
commit
1cca0d46de
4 changed files with 58 additions and 4 deletions
|
|
@ -13,7 +13,8 @@ use tar::Archive;
|
|||
use tokio::fs::File;
|
||||
use tokio_util::io::StreamReader;
|
||||
use tower_http::{
|
||||
services::ServeDir, trace::TraceLayer, validate_request::ValidateRequestHeaderLayer,
|
||||
compression::CompressionLayer, services::ServeDir, trace::TraceLayer,
|
||||
validate_request::ValidateRequestHeaderLayer,
|
||||
};
|
||||
|
||||
use std::{
|
||||
|
|
@ -50,7 +51,8 @@ pub fn app(
|
|||
app = app.route(path, any(|| async { Redirect::permanent(url) }))
|
||||
}
|
||||
|
||||
app.layer(TraceLayer::new_for_http())
|
||||
app.layer(CompressionLayer::new().gzip(true).br(true))
|
||||
.layer(TraceLayer::new_for_http())
|
||||
}
|
||||
|
||||
pub async fn post_static_archive(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue