pub struct GoHeaders { /* private fields */ }Expand description
Headers in the order Go’s HTTP/1.1 client writes them: Host, User-Agent (Go’s default when unset), Content-Length, the remaining request headers sorted by key with their values in order, then the transport’s Accept-Encoding.
Implementations§
Source§impl GoHeaders
impl GoHeaders
pub fn new() -> Self
Sourcepub fn add_raw(&mut self, name: &str, value: impl Into<String>)
pub fn add_raw(&mut self, name: &str, value: impl Into<String>)
Appends a value under a key that keeps its exact spelling (a raw http.Header
map key in Go, written as stored).
Sourcepub fn disable_compression(&mut self)
pub fn disable_compression(&mut self)
Go http.Transport.DisableCompression (Devin’s transport): no automatic
Accept-Encoding: gzip, so responses are never decoded transparently.
Sourcepub fn exact_target(&mut self)
pub fn exact_target(&mut self)
Go’s net/url for every hop: the caller’s URL is parsed as url.Parse does, each
redirect Location is resolved with URL.Parse (ResolveReference), and each
request goes out with Go’s URL.RequestURI(), so dot segments, percent escapes and
the query stay as Go keeps them. A URL or Location Go fails to parse, one without
a host, and one whose target wreq would not send as is (go_target) fail the
request. Without it every URL is normalized as WHATWG parses it.
Sourcepub fn pairs(&self) -> &[(String, String)]
pub fn pairs(&self) -> &[(String, String)]
The headers as Go’s http.Header holds them before sending (Header.Clone(), what
request logging records): set names canonical, raw names as written, values in
order. The transport’s own lines (Host from the URL, the default User-Agent,
Content-Length, Accept-Encoding) are not included.
pub fn get(&self, name: &str) -> Option<&str>
Sourcepub fn take(&mut self, name: &str) -> Option<String>
pub fn take(&mut self, name: &str) -> Option<String>
Removes every value of name (http.Header.Del) and returns the first.
Sourcepub fn apply(
self,
builder: RequestBuilder,
order: Option<&[String]>,
) -> (RequestBuilder, bool)
pub fn apply( self, builder: RequestBuilder, order: Option<&[String]>, ) -> (RequestBuilder, bool)
Applies the headers with their wire spelling. order is an exact header order
(Claude’s ordered request writer); None writes Go net/http’s order. Returns
whether the transport asked for gzip itself (no explicit Accept-Encoding or
Range), which is the only case Go decodes transparently.
Trait Implementations§
Auto Trait Implementations§
impl Forget for GoHeaders
impl Freeze for GoHeaders
impl Move for GoHeaders
impl RefUnwindSafe for GoHeaders
impl Send for GoHeaders
impl Sync for GoHeaders
impl Unpin for GoHeaders
impl UnsafeUnpin for GoHeaders
impl UnwindSafe for GoHeaders
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more