Skip to content

Commit a0e63c5

Browse files
committed
chore(example): format code in examples
1 parent 808da8c commit a0e63c5

6 files changed

Lines changed: 11 additions & 15 deletions

File tree

examples/keylog.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ async fn main() -> wreq::Result<()> {
1111
// Use the API you're already familiar with
1212
let resp = client.get("https://api.ip.sb/ip").send().await?;
1313
println!("{}", resp.text().await?);
14+
1415
Ok(())
1516
}

examples/request_with_interface.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ async fn main() -> wreq::Result<()> {
1616
.with_max_level(tracing::Level::TRACE)
1717
.init();
1818

19-
let text = wreq::Client::new()
19+
// Use the API you're already familiar with
20+
let resp = wreq::Client::new()
2021
.get("https://api.ip.sb/ip")
2122
.interface("utun4")
2223
.send()
23-
.await?
24-
.text()
2524
.await?;
26-
27-
println!("{text}");
25+
println!("{}", resp.text().await?);
2826

2927
Ok(())
3028
}

examples/request_with_local_address.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ async fn main() -> wreq::Result<()> {
88
.with_max_level(tracing::Level::TRACE)
99
.init();
1010

11+
// Use the API you're already familiar with
1112
let resp = wreq::Client::new()
1213
.get("http://www.baidu.com")
1314
.redirect(Policy::default())
1415
.local_address(IpAddr::from([192, 168, 1, 226]))
1516
.send()
1617
.await?;
17-
1818
println!("{}", resp.text().await?);
1919

2020
Ok(())

examples/request_with_proxy.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ async fn main() -> wreq::Result<()> {
66
.with_max_level(tracing::Level::TRACE)
77
.init();
88

9+
// Use the API you're already familiar with
910
let resp = Client::new()
1011
.get("https://api.ip.sb/ip")
1112
.proxy(Proxy::all("socks5h://localhost:6153")?)
1213
.send()
13-
.await?
14-
.text()
1514
.await?;
16-
17-
println!("{resp}");
15+
println!("{}", resp.text().await?);
1816

1917
Ok(())
2018
}

examples/request_with_redirect.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ async fn main() -> wreq::Result<()> {
66
.with_max_level(tracing::Level::TRACE)
77
.init();
88

9+
// Use the API you're already familiar with
910
let resp = wreq::Client::new()
1011
.get("http://google.com/")
1112
.redirect(Policy::default())
1213
.send()
13-
.await?
14-
.text()
1514
.await?;
16-
17-
println!("{resp}");
15+
println!("{}", resp.text().await?);
1816

1917
Ok(())
2018
}

examples/request_with_version.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ async fn main() -> wreq::Result<()> {
66
.with_max_level(tracing::Level::TRACE)
77
.init();
88

9+
// Use the API you're already familiar with
910
let resp = wreq::Client::new()
10-
.get("https://tls.peet.ws/api/all")
11+
.get("https://www.google.com")
1112
.version(Version::HTTP_11)
1213
.send()
1314
.await?;

0 commit comments

Comments
 (0)