1
0
mirror of https://github.com/actix/actix-website synced 2025-06-27 15:39:02 +02:00

Update information on Compress middleware (#279)

This commit is contained in:
Kenneth Allen
2022-07-19 20:11:45 +10:00
committed by GitHub
parent 2904c4b861
commit bb42ca002c
5 changed files with 9 additions and 86 deletions

View File

@ -1,20 +0,0 @@
// <brotli>
use actix_web::{get, middleware, App, HttpResponse, HttpServer};
#[get("/")]
async fn index_br() -> HttpResponse {
HttpResponse::Ok().body("data")
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.wrap(middleware::Compress::default())
.service(index_br)
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}
// </brotli>

View File

@ -1,21 +0,0 @@
// <brotli-two>
use actix_web::{http::ContentEncoding, dev::BodyEncoding, HttpResponse};
async fn index_br() -> HttpResponse {
HttpResponse::Ok().body("data")
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
use actix_web::{middleware, web, App, HttpServer};
HttpServer::new(|| {
App::new()
.wrap(middleware::Compress::new(ContentEncoding::Br))
.route("/", web::get().to(index_br))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}
// </brotli-two>

View File

@ -1,20 +0,0 @@
// <compress>
use actix_web::{get, middleware, App, HttpResponse, HttpServer};
#[get("/")]
async fn index_br() -> HttpResponse {
HttpResponse::Ok().body("data")
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.wrap(middleware::Compress::default())
.service(index_br)
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}
// </compress>

View File

@ -1,7 +1,5 @@
pub mod auto;
pub mod brotli;
pub mod chunked;
pub mod compress;
pub mod identity;
pub mod identity_two;
pub mod json_resp;