Struct ntex::web::middleware::Compress [−][src]
pub struct Compress { /* fields omitted */ }
Expand description
Middleware
for compressing response body.
Use BodyEncoding
trait for overriding response compression.
To disable compression set encoding to ContentEncoding::Identity
value.
use ntex::web::{self, middleware, App, HttpResponse};
fn main() {
let app = App::new()
.wrap(middleware::Compress::default())
.service(
web::resource("/test")
.route(web::get().to(|| async { HttpResponse::Ok() }))
.route(web::head().to(|| async { HttpResponse::MethodNotAllowed() }))
);
}
Implementations
Create new Compress
middleware with default encoding.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Compress
impl UnwindSafe for Compress
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more