Skip to content

Commit

Permalink
docs(examples): gateway: remove extra slash for uri (#2351)
Browse files Browse the repository at this point in the history
The PathAndQuery already contains the leading slash, which erroneously
sets the proxied path to "//.." and not "/..".
  • Loading branch information
Jim-Holmstroem authored Dec 3, 2020
1 parent f864173 commit 3cb6b4e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3cb6b4e

Please sign in to comment.