@@ -136,6 +136,7 @@ impl Server {
136136 async fn handle_fallible_get_async < F , R , S , E > (
137137 & self ,
138138 req : & Request ,
139+ compression : & Option < BrotliEncoderParams > ,
139140 handler : F ,
140141 ) -> Result < Response , ServerError >
141142 where
@@ -154,7 +155,7 @@ impl Server {
154155 . header_typed ( ContentType :: json ( ) )
155156 . header_typed ( CacheControl :: new ( ) . with_no_cache ( ) . with_no_store ( ) ) ;
156157 let body = serde_json:: to_vec ( & result) . unwrap ( ) ;
157- response. body ( hyper :: Body :: from ( body ) ) . unwrap ( )
158+ maybe_compressed_response ( response, body, compression )
158159 }
159160 Err ( err) => http:: Response :: builder ( )
160161 . status ( StatusCode :: INTERNAL_SERVER_ERROR )
@@ -368,13 +369,17 @@ async fn serve_req(server: Server, req: Request) -> Result<Response, ServerError
368369 "/perf/graph" => {
369370 let query = check ! ( parse_query_string( req. uri( ) ) ) ;
370371 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+ } )
372375 . await ;
373376 }
374377 "/perf/graphs" => {
375378 let query = check ! ( parse_query_string( req. uri( ) ) ) ;
376379 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+ } )
378383 . await ;
379384 }
380385 "/perf/metrics" => {
0 commit comments