@@ -827,14 +827,12 @@ mod tests {
827827 when. matches ( |req| {
828828 let headers = req. headers ( ) ;
829829 let accept_encoding_header = headers
830- . iter ( )
831- . find ( |( name, _values) | name. to_string ( ) . to_lowercase ( ) == "accept-encoding" )
830+ . get ( "accept-encoding" )
832831 . expect ( "Accept-Encoding header not found" ) ;
833832
834- let header_value = accept_encoding_header. 1 ;
835- [ "gzip" , "br" , "deflate" , "zstd" ]
836- . iter ( )
837- . all ( |& value| header_value. to_str ( ) . unwrap ( ) . contains ( value) )
833+ [ "gzip" , "br" , "deflate" , "zstd" ] . iter ( ) . all ( |& encoding| {
834+ accept_encoding_header. to_str ( ) . is_ok_and ( |h| h. contains ( encoding) )
835+ } )
838836 } ) ;
839837
840838 then. status ( 200 ) . body ( "ok" ) ;
@@ -855,14 +853,12 @@ mod tests {
855853 when. matches ( |req| {
856854 let headers = req. headers ( ) ;
857855 let accept_encoding_header = headers
858- . iter ( )
859- . find ( |( name, _values) | name. to_string ( ) . to_lowercase ( ) == "accept-encoding" )
856+ . get ( "accept-encoding" )
860857 . expect ( "Accept-Encoding header not found" ) ;
861858
862- let header_value = accept_encoding_header. 1 ;
863- [ "gzip" , "br" , "deflate" , "zstd" ]
864- . iter ( )
865- . all ( |& value| header_value. to_str ( ) . unwrap ( ) . contains ( value) )
859+ [ "gzip" , "br" , "deflate" , "zstd" ] . iter ( ) . all ( |& encoding| {
860+ accept_encoding_header. to_str ( ) . is_ok_and ( |h| h. contains ( encoding) )
861+ } )
866862 } ) ;
867863
868864 then. status ( 200 ) . body ( "ok" ) ;
0 commit comments