backend-client: route requests through HTTP client factory

This commit is contained in:
Michael Bolin
2026-07-09 15:34:38 -07:00
parent 6cc150c02e
commit 7d7e2d9354
19 changed files with 341 additions and 124 deletions
+1
View File
@@ -19,6 +19,7 @@ chrono = { workspace = true, features = ["serde"] }
codex-api = { workspace = true }
codex-backend-client = { workspace = true }
codex-git-utils = { workspace = true }
codex-http-client = { workspace = true }
serde = { version = "1", features = ["derive"] }
serde_json = { workspace = true }
thiserror = { workspace = true }
+6 -3
View File
@@ -28,10 +28,13 @@ pub struct HttpClient {
}
impl HttpClient {
pub fn new(base_url: impl Into<String>) -> anyhow::Result<Self> {
pub fn new(
base_url: impl Into<String>,
http_client_factory: codex_http_client::HttpClientFactory,
) -> Self {
let base_url = base_url.into();
let backend = backend::Client::new(base_url.clone())?;
Ok(Self { base_url, backend })
let backend = backend::Client::new(base_url.clone(), http_client_factory);
Self { base_url, backend }
}
pub fn with_user_agent(mut self, ua: impl Into<String>) -> Self {