summaryrefslogtreecommitdiff
path: root/ext/fetch/lib.rs
diff options
context:
space:
mode:
authorRaashid Anwar <raashid12anwar@gmail.com>2023-12-31 18:15:12 +0530
committerGitHub <noreply@github.com>2023-12-31 12:45:12 +0000
commit8ba828b41e2609c91d993aec464035d62320fdad (patch)
tree84ca9496153390f99083d2126edd5b4d9ce41dbb /ext/fetch/lib.rs
parent4339a6c55db8252b54ee96e38e2e1b084e28d7e2 (diff)
fix(http_client): Fix Deno.createHttpClient to accept poolIdleTimeout parameter (#21603)
Fixed the bug `Deno.createHttpClient` to accept `poolIdleTimeout` parameter. Fixes https://github.com/denoland/deno/issues/21546
Diffstat (limited to 'ext/fetch/lib.rs')
-rw-r--r--ext/fetch/lib.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs
index 6a2ac2ef9..ee8f30b59 100644
--- a/ext/fetch/lib.rs
+++ b/ext/fetch/lib.rs
@@ -789,13 +789,6 @@ impl HttpClientResource {
}
}
-#[derive(Deserialize, Debug, Clone)]
-#[serde(rename_all = "camelCase")]
-pub enum PoolIdleTimeout {
- State(bool),
- Specify(u64),
-}
-
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct CreateHttpClientArgs {
@@ -804,7 +797,7 @@ pub struct CreateHttpClientArgs {
cert_chain: Option<String>,
private_key: Option<String>,
pool_max_idle_per_host: Option<usize>,
- pool_idle_timeout: Option<PoolIdleTimeout>,
+ pool_idle_timeout: Option<serde_json::Value>,
#[serde(default = "default_true")]
http1: bool,
#[serde(default = "default_true")]
@@ -867,9 +860,12 @@ where
pool_max_idle_per_host: args.pool_max_idle_per_host,
pool_idle_timeout: args.pool_idle_timeout.and_then(
|timeout| match timeout {
- PoolIdleTimeout::State(true) => None,
- PoolIdleTimeout::State(false) => Some(None),
- PoolIdleTimeout::Specify(specify) => Some(Some(specify)),
+ serde_json::Value::Bool(true) => None,
+ serde_json::Value::Bool(false) => Some(None),
+ serde_json::Value::Number(specify) => {
+ Some(Some(specify.as_u64().unwrap_or_default()))
+ }
+ _ => Some(None),
},
),
http1: args.http1,