mirror of
https://github.com/openai/codex.git
synced 2026-10-18 17:18:52 +00:00
Migrate core test support to the shared HTTP client (#34651)
## What changed - Send the streaming SSE request-body drain test through `HttpClientFactory`. - Replace the test-support crate's direct `reqwest` dependency with `codex-http-client`. - Remove `core_test_support` from the temporary direct-`reqwest` exceptions. GitOrigin-RevId: 16ea4309d0b575592c2e59991eb6dce18d9467ed
This commit is contained in:
Generated
+1
-1
@@ -4770,6 +4770,7 @@ dependencies = [
|
||||
"codex-features",
|
||||
"codex-home",
|
||||
"codex-hooks",
|
||||
"codex-http-client",
|
||||
"codex-login",
|
||||
"codex-model-provider-info",
|
||||
"codex-models-manager",
|
||||
@@ -4784,7 +4785,6 @@ dependencies = [
|
||||
"opentelemetry_sdk",
|
||||
"pretty_assertions",
|
||||
"regex-lite",
|
||||
"reqwest 0.12.28",
|
||||
"serde_json",
|
||||
"shlex",
|
||||
"similar",
|
||||
|
||||
@@ -50,5 +50,5 @@ shlex = { workspace = true }
|
||||
zstd = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
codex-http-client = { workspace = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
|
||||
@@ -284,8 +284,10 @@ fn unix_ms_now() -> i64 {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use codex_http_client::ClientRouteClass;
|
||||
use codex_http_client::HttpClientFactory;
|
||||
use codex_http_client::OutboundProxyPolicy;
|
||||
use pretty_assertions::assert_eq;
|
||||
use reqwest::StatusCode;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::time::Duration;
|
||||
use tokio::time::timeout;
|
||||
@@ -607,13 +609,16 @@ data: {"type":"response.completed","response":{"id":"resp-1"}}
|
||||
"stream": true
|
||||
});
|
||||
|
||||
let resp = reqwest::Client::new()
|
||||
let client = HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault)
|
||||
.build_client(&url, ClientRouteClass::Other)
|
||||
.expect("build HTTP client");
|
||||
let resp = client
|
||||
.post(url)
|
||||
.json(&payload)
|
||||
.send()
|
||||
.await
|
||||
.expect("send request");
|
||||
assert_eq!(resp.status(), StatusCode::OK);
|
||||
assert_eq!(resp.status().as_u16(), 200);
|
||||
|
||||
let bytes = resp.bytes().await.expect("read response body");
|
||||
assert_eq!(bytes, response_body.as_bytes());
|
||||
|
||||
@@ -250,7 +250,6 @@ deny = [
|
||||
"codex-responses-api-proxy",
|
||||
"codex-rmcp-client",
|
||||
"codex-tui",
|
||||
"core_test_support",
|
||||
# Third-party crates that own their reqwest integration. These are not part of the
|
||||
# first-party migration count above.
|
||||
"oauth2",
|
||||
|
||||
Reference in New Issue
Block a user