Skip to content

Commit b462e61

Browse files
authored
examples/actix-web.rs: default enable compress middleware. (#192)
Signed-off-by: Jonathan Davies <[email protected]>
1 parent de27234 commit b462e61

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

examples/actix-web.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::sync::Mutex;
22

3+
use actix_web::middleware::Compress;
34
use actix_web::{web, App, HttpResponse, HttpServer, Responder, Result};
45
use prometheus_client::encoding::text::encode;
56
use prometheus_client::encoding::{EncodeLabelSet, EncodeLabelValue};
@@ -61,6 +62,7 @@ async fn main() -> std::io::Result<()> {
6162

6263
HttpServer::new(move || {
6364
App::new()
65+
.wrap(Compress::default())
6466
.app_data(metrics.clone())
6567
.app_data(state.clone())
6668
.service(web::resource("/metrics").route(web::get().to(metrics_handler)))

0 commit comments

Comments
 (0)