Skip to content

Commit

Permalink
Merge pull request #2015 from freedomofpress/reqwest-0.12
Browse files Browse the repository at this point in the history
Upgrade reqwest to 0.12
  • Loading branch information
rocodes authored Jun 3, 2024
2 parents e50e0ff + 820a470 commit f5f0522
Show file tree
Hide file tree
Showing 6 changed files with 315 additions and 124 deletions.
149 changes: 119 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ qubesdb = []
[dependencies]
anyhow = {version = "1.0.75"}
futures-util = "0.3.30"
reqwest = {version = "0.11.20", features = ["gzip", "stream"]}
reqwest = { version = "0.12", features = ["gzip", "stream"] }
serde = {version = "1.0.188", features = ["derive"]}
serde_json = "1.0.107"
tokio = {version = "1.0", features = ["macros", "rt"]}
Expand Down
8 changes: 5 additions & 3 deletions proxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ async fn main() -> ExitCode {
match proxy().await {
Ok(()) => ExitCode::SUCCESS,
Err(err) => {
let mut error = err.to_string();
if let Some(source) = err.source() {
error = format!("{}: {}", error, source);
}
// Try to serialize into our error format
let resp = ErrorResponse {
error: err.to_string(),
};
let resp = ErrorResponse { error };
match serde_json::to_string(&resp) {
Ok(json) => {
// Print the error to stderr
Expand Down
3 changes: 1 addition & 2 deletions proxy/tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,5 @@ def test_cannot_connect(proxy_request):
assert (
result.stderr.decode().strip()
== '{"error":"error sending request for url (http://missing.test/): '
+ "error trying to connect: dns error: failed to lookup address information: "
+ 'Name or service not known"}'
+ 'client error (Connect)"}'
)
Loading

0 comments on commit f5f0522

Please sign in to comment.