From 34c406116bfa2ffdcc3c9e7e911fe98df73f4d4f Mon Sep 17 00:00:00 2001 From: Jim Holmstrom Date: Thu, 3 Dec 2020 19:15:26 +0100 Subject: [PATCH] fix(examples) remove extra slash for uri The PathAndQuery already contains the leading slash, which erroneously sets the proxied path to "//.." and not "/..". --- examples/gateway.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/gateway.rs b/examples/gateway.rs index a826737905..bd61130af7 100644 --- a/examples/gateway.rs +++ b/examples/gateway.rs @@ -26,9 +26,12 @@ async fn main() { // returns a Response into a `Service`. Ok::<_, Error>(service_fn(move |mut req| { let uri_string = format!( - "http://{}/{}", + "http://{}{}", out_addr_clone, - req.uri().path_and_query().map(|x| x.as_str()).unwrap_or("") + req.uri() + .path_and_query() + .map(|x| x.as_str()) + .unwrap_or("/") ); let uri = uri_string.parse().unwrap(); *req.uri_mut() = uri;