1
0
mirror of https://github.com/actix/actix-website synced 2024-12-18 18:03:12 +01:00
actix-website/examples/responses/src/identity.rs
2020-09-12 16:21:54 +01:00

26 lines
561 B
Rust

// <identity>
use actix_web::{
dev::BodyEncoding, get, http::ContentEncoding, middleware, App, HttpResponse, HttpServer,
};
#[get("/")]
async fn index() -> HttpResponse {
HttpResponse::Ok()
// v- disable compression
.encoding(ContentEncoding::Identity)
.body("data")
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.wrap(middleware::Compress::default())
.service(index)
})
.bind("127.0.0.1:8080")?
.run()
.await
}
// </identity>