-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(client): Add
impersonate_with_headers
allows optionally settin…
…g request headers (#127)
- Loading branch information
Showing
2 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use rquest::tls::Impersonate; | ||
use std::error::Error; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn Error>> { | ||
// Build a client to mimic Edge127 with headers | ||
let client = rquest::Client::builder() | ||
.impersonate_with_headers(Impersonate::Edge127, false) | ||
.enable_ech_grease() | ||
.permute_extensions() | ||
.build()?; | ||
|
||
// Use the API you're already familiar with | ||
let resp = client.get("https://tls.peet.ws/api/all").send().await?; | ||
println!("{}", resp.text().await?); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters