Skip to content

Commit

Permalink
fix(examples): send only path of URI in request
Browse files Browse the repository at this point in the history
  • Loading branch information
kiron1 committed Nov 30, 2023
1 parent 6a57d64 commit 6101dd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ async fn fetch_url(url: hyper::Uri) -> Result<()> {
});

let authority = url.authority().unwrap().clone();
let uri = url.path_and_query().map(|p| p.as_str()).unwrap_or("/");

let req = Request::builder()
.uri(url)
.uri(uri)
.header(hyper::header::HOST, authority.as_str())
.body(Empty::<Bytes>::new())?;

Expand Down
3 changes: 2 additions & 1 deletion examples/client_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ async fn fetch_json(url: hyper::Uri) -> Result<Vec<User>> {
});

let authority = url.authority().unwrap().clone();
let uri = url.path_and_query().map(|p| p.as_str()).unwrap_or("/");

// Fetch the url...
let req = Request::builder()
.uri(url)
.uri(uri)
.header(hyper::header::HOST, authority.as_str())
.body(Empty::<Bytes>::new())?;

Expand Down

0 comments on commit 6101dd6

Please sign in to comment.