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