diff --git a/src/client.rs b/src/client.rs index 704f97cf..fa2d7f3e 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1174,6 +1174,11 @@ impl HttpClient { headers.append(&header_to_curl_string(name, value, title_case))?; } + request + .extensions() + .get::() + .map(|_| headers.append("Expect:")); + easy.http_headers(headers)?; Ok((easy, future)) diff --git a/src/config/mod.rs b/src/config/mod.rs index 1364356c..69efead2 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -566,6 +566,11 @@ pub trait Configurable: internal::ConfigurableBase { self.configure(TitleCaseHeaders(enable)) } + /// Disable using `Expect` header to test request validity + fn disable_expect_header(self) -> Self { + self.configure(DisableExpectHeader(true)) + } + /// Enable or disable comprehensive per-request metrics collection. /// /// When enabled, detailed timing metrics will be tracked while a request is @@ -919,3 +924,7 @@ impl SetOpt for IpVersion { /// Send header names as title case instead of lowercase. #[derive(Clone, Debug)] pub(crate) struct TitleCaseHeaders(pub(crate) bool); + +/// Disable Expect Header usage +#[derive(Clone, Debug)] +pub(crate) struct DisableExpectHeader(pub(crate) bool);