@@ -136,6 +136,7 @@ impl Server {
136
136
async fn handle_fallible_get_async < F , R , S , E > (
137
137
& self ,
138
138
req : & Request ,
139
+ compression : & Option < BrotliEncoderParams > ,
139
140
handler : F ,
140
141
) -> Result < Response , ServerError >
141
142
where
@@ -154,7 +155,7 @@ impl Server {
154
155
. header_typed ( ContentType :: json ( ) )
155
156
. header_typed ( CacheControl :: new ( ) . with_no_cache ( ) . with_no_store ( ) ) ;
156
157
let body = serde_json:: to_vec ( & result) . unwrap ( ) ;
157
- response. body ( hyper :: Body :: from ( body ) ) . unwrap ( )
158
+ maybe_compressed_response ( response, body, compression )
158
159
}
159
160
Err ( err) => http:: Response :: builder ( )
160
161
. status ( StatusCode :: INTERNAL_SERVER_ERROR )
@@ -368,13 +369,17 @@ async fn serve_req(server: Server, req: Request) -> Result<Response, ServerError
368
369
"/perf/graph" => {
369
370
let query = check ! ( parse_query_string( req. uri( ) ) ) ;
370
371
return server
371
- . handle_fallible_get_async ( & req, |c| request_handlers:: handle_graph ( query, c) )
372
+ . handle_fallible_get_async ( & req, & compression, |c| {
373
+ request_handlers:: handle_graph ( query, c)
374
+ } )
372
375
. await ;
373
376
}
374
377
"/perf/graphs" => {
375
378
let query = check ! ( parse_query_string( req. uri( ) ) ) ;
376
379
return server
377
- . handle_fallible_get_async ( & req, |c| request_handlers:: handle_graphs ( query, c) )
380
+ . handle_fallible_get_async ( & req, & compression, |c| {
381
+ request_handlers:: handle_graphs ( query, c)
382
+ } )
378
383
. await ;
379
384
}
380
385
"/perf/metrics" => {
0 commit comments