@@ -66,14 +66,15 @@ pub async fn handle_generic_proxy(
6666 ) ;
6767
6868 // Extract target path
69- let target_path = mapping
70- . extract_target_path ( path)
71- . ok_or_else ( || TrustedServerError :: Proxy {
72- message : format ! (
73- "Failed to extract target path from {} with prefix {}" ,
74- path, mapping. prefix
75- ) ,
76- } ) ?;
69+ let target_path =
70+ mapping
71+ . extract_target_path ( path)
72+ . ok_or_else ( || TrustedServerError :: Proxy {
73+ message : format ! (
74+ "Failed to extract target path from {} with prefix {}" ,
75+ path, mapping. prefix
76+ ) ,
77+ } ) ?;
7778
7879 // Build full target URL with query parameters
7980 let target_url = build_target_url ( & mapping. target , target_path, & req) ?;
@@ -95,11 +96,12 @@ pub async fn handle_generic_proxy(
9596 // Get backend and forward request
9697 let backend_name = ensure_backend_from_url ( & mapping. target ) ?;
9798
98- let target_response = target_req
99- . send ( backend_name)
100- . change_context ( TrustedServerError :: Proxy {
101- message : format ! ( "Failed to forward request to {}" , target_url) ,
102- } ) ?;
99+ let target_response =
100+ target_req
101+ . send ( backend_name)
102+ . change_context ( TrustedServerError :: Proxy {
103+ message : format ! ( "Failed to forward request to {}" , target_url) ,
104+ } ) ?;
103105
104106 log:: info!(
105107 "Target responded with status: {}" ,
@@ -119,9 +121,7 @@ fn find_proxy_mapping<'a>(
119121 settings
120122 . proxy_mappings
121123 . iter ( )
122- . find ( |mapping| {
123- mapping. matches_path ( path) && mapping. supports_method ( method. as_str ( ) )
124- } )
124+ . find ( |mapping| mapping. matches_path ( path) && mapping. supports_method ( method. as_str ( ) ) )
125125 . ok_or_else ( || {
126126 TrustedServerError :: Proxy {
127127 message : format ! (
@@ -252,10 +252,7 @@ mod tests {
252252 Some ( "/v2/projects" )
253253 ) ;
254254 assert_eq ! ( mapping. extract_target_path( "/permutive/api" ) , Some ( "" ) ) ;
255- assert_eq ! (
256- mapping. extract_target_path( "/permutive/api/" ) ,
257- Some ( "/" )
258- ) ;
255+ assert_eq ! ( mapping. extract_target_path( "/permutive/api/" ) , Some ( "/" ) ) ;
259256 assert_eq ! ( mapping. extract_target_path( "/other/path" ) , None ) ;
260257 }
261258
0 commit comments