Skip to content

Commit 8951d09

Browse files
committed
chore(deps): unify ureq on v3 across workspace
The cli dev-dep pinned ureq v2 for a single test while vykar-storage already uses v3 in production. Hoist ureq into [workspace.dependencies] and migrate the daemon http test to the v3 API so the duplicate (and its distinct TLS/cookie/encoding transitives) drops out of Cargo.lock.
1 parent 58ee46d commit 8951d09

5 files changed

Lines changed: 31 additions & 41 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ croner = "3"
4848
tracing = "0.1"
4949
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
5050

51+
# HTTP client
52+
ureq = "3"
53+
5154
# Concurrency
5255
crossbeam-channel = "0.5"
5356
tokio = { version = "1", default-features = false }

crates/vykar-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ serde_json.workspace = true
3636

3737
[dev-dependencies]
3838
tempfile.workspace = true
39-
ureq = "2"
39+
ureq.workspace = true
4040

4141
[target.'cfg(unix)'.dependencies]
4242
libc = "0.2"

crates/vykar-cli/src/cmd/daemon/http.rs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,35 +163,47 @@ mod tests {
163163
}
164164
std::thread::sleep(Duration::from_millis(50));
165165
}
166-
let html = html.unwrap_or_else(|| panic!("no /: {last_err:?}"));
167-
assert_eq!(html.status(), 200);
168-
let ct = html.header("content-type").unwrap_or_default().to_string();
166+
let mut html = html.unwrap_or_else(|| panic!("no /: {last_err:?}"));
167+
assert_eq!(html.status().as_u16(), 200);
168+
let ct = html
169+
.headers()
170+
.get("content-type")
171+
.and_then(|v| v.to_str().ok())
172+
.unwrap_or_default()
173+
.to_string();
169174
assert!(ct.starts_with("text/html"), "ct = {ct}");
170-
let body = html.into_string().unwrap();
175+
let body = html.body_mut().read_to_string().unwrap();
171176
assert!(body.contains("rA"));
172177

173178
let healthz = ureq::get(&format!("{base}/healthz")).call().unwrap();
174-
assert_eq!(healthz.status(), 200);
179+
assert_eq!(healthz.status().as_u16(), 200);
175180
assert_eq!(
176-
healthz.header("content-type").unwrap_or_default(),
181+
healthz
182+
.headers()
183+
.get("content-type")
184+
.and_then(|v| v.to_str().ok())
185+
.unwrap_or_default(),
177186
"text/plain; charset=utf-8"
178187
);
179188

180-
let json = ureq::get(&format!("{base}/api/status.json"))
189+
let mut json = ureq::get(&format!("{base}/api/status.json"))
181190
.call()
182191
.unwrap();
183-
assert_eq!(json.status(), 200);
192+
assert_eq!(json.status().as_u16(), 200);
184193
assert_eq!(
185-
json.header("content-type").unwrap_or_default(),
194+
json.headers()
195+
.get("content-type")
196+
.and_then(|v| v.to_str().ok())
197+
.unwrap_or_default(),
186198
"application/json"
187199
);
188-
let body = json.into_string().unwrap();
200+
let body = json.body_mut().read_to_string().unwrap();
189201
let parsed: serde_json::Value = serde_json::from_str(&body).unwrap();
190202
assert_eq!(parsed["repos"][0]["name"], "rA");
191203

192204
let nope = ureq::get(&format!("{base}/nope")).call();
193205
match nope {
194-
Err(ureq::Error::Status(404, _)) => {}
206+
Err(ureq::Error::StatusCode(404)) => {}
195207
other => panic!("expected 404, got {other:?}"),
196208
}
197209

crates/vykar-storage/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ percent-encoding = "2"
3232

3333
# HTTP client (S3 + REST backends)
3434
rusty-s3 = "0.9.1"
35-
ureq = { version = "3", features = ["json"] }
35+
ureq = { workspace = true, features = ["json"] }
3636
http = "1"
3737

3838
# Logging

0 commit comments

Comments
 (0)