From 01343df729dd1c24455229ad3472c22705fd009e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jim=20Holmstr=C3=B6m?= Date: Thu, 3 Dec 2020 22:36:32 +0100 Subject: [PATCH] docs(examples): gateway: remove extra slash for uri (#2351) 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;