File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -836,5 +836,20 @@ mod tests {
836836 . unwrap ( ) ;
837837 assert_eq ! ( response. headers( ) , expected_response. headers( ) ) ;
838838 assert_eq ! ( hyper:: body:: to_bytes( response. into_body( ) ) . await . unwrap( ) , hyper:: body:: to_bytes( expected_response. into_body( ) ) . await . unwrap( ) ) ;
839+
840+ // Test case 2: Path is "/compare.html"
841+ let req = Request :: default ( ) ;
842+ let path = "/compare.html" ;
843+ let use_compression = false ;
844+ let response = handle_fs_path ( & req, path, use_compression) . await . unwrap ( ) ;
845+ let expected_body = TEMPLATES . get_template ( "compare.html" ) . await . unwrap ( ) ;
846+ let expected_response = http:: Response :: builder ( )
847+ . header_typed ( ETag :: from_str ( & format ! ( r#""{}""# , * VERSION_UUID ) ) . unwrap ( ) )
848+ . header ( CACHE_CONTROL , "max-age=60, stale-while-revalidate=86400" )
849+ . header_typed ( ContentType :: html ( ) )
850+ . body ( hyper:: Body :: from ( expected_body) )
851+ . unwrap ( ) ;
852+ assert_eq ! ( response. headers( ) , expected_response. headers( ) ) ;
853+ assert_eq ! ( hyper:: body:: to_bytes( response. into_body( ) ) . await . unwrap( ) , hyper:: body:: to_bytes( expected_response. into_body( ) ) . await . unwrap( ) ) ;
839854 }
840855}
You can’t perform that action at this time.
0 commit comments