Skip to content

Commit e359542

Browse files
committed
fix(examples): send only path of URI in request
1 parent 210bfaa commit e359542

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/client.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ async fn fetch_url(url: hyper::Uri) -> Result<()> {
5454
});
5555

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

5859
let req = Request::builder()
59-
.uri(url)
60+
.uri(uri)
6061
.header(hyper::header::HOST, authority.as_str())
6162
.body(Empty::<Bytes>::new())?;
6263

examples/client_json.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ async fn fetch_json(url: hyper::Uri) -> Result<Vec<User>> {
4343
});
4444

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

4748
// Fetch the url...
4849
let req = Request::builder()
49-
.uri(url)
50+
.uri(uri)
5051
.header(hyper::header::HOST, authority.as_str())
5152
.body(Empty::<Bytes>::new())?;
5253

0 commit comments

Comments
 (0)