pub struct Request { /* private fields */ }Expand description
An outgoing HTTP request.
§Security
The Debug implementation redacts secrets: the URL is rendered without
userinfo, query parameters, or fragments (query strings routinely carry
API keys), sensitive headers use the redacted form, and the body is
summarized by length only. See crate::redact.
Implementations§
Source§impl Request
impl Request
Sourcepub fn headers_mut(&mut self) -> &mut Headers
pub fn headers_mut(&mut self) -> &mut Headers
Returns a mutable reference to the request headers.
Sourcepub fn body(&self) -> &RequestBody
pub fn body(&self) -> &RequestBody
Returns the request body.
Sourcepub fn set_body(&mut self, body: RequestBody)
pub fn set_body(&mut self, body: RequestBody)
Set the request body.
Sourcepub fn set_version(&mut self, version: Version)
pub fn set_version(&mut self, version: Version)
Set the HTTP version.
Sourcepub fn set_timeout(&mut self, timeout: Option<Timeout>)
pub fn set_timeout(&mut self, timeout: Option<Timeout>)
Set the request-level timeout.
Sourcepub fn redirect(&self) -> Option<&RedirectPolicy>
pub fn redirect(&self) -> Option<&RedirectPolicy>
Returns the request-level redirect policy override, if set.
Only available with the redirects feature.
Sourcepub fn set_redirect(&mut self, redirect: Option<RedirectPolicy>)
pub fn set_redirect(&mut self, redirect: Option<RedirectPolicy>)
Set the request-level redirect policy override.
Only available with the redirects feature.
Sourcepub fn auth(&self) -> Option<&AuthScheme>
pub fn auth(&self) -> Option<&AuthScheme>
Returns a reference to the request-level auth override, if set.
Sourcepub fn set_auth(&mut self, auth: Option<AuthScheme>)
pub fn set_auth(&mut self, auth: Option<AuthScheme>)
Set the request-level auth override.
Sourcepub fn is_auth_disabled(&self) -> bool
pub fn is_auth_disabled(&self) -> bool
Returns whether auth has been explicitly disabled for this request.
Sourcepub fn set_auth_disabled(&mut self, disabled: bool)
pub fn set_auth_disabled(&mut self, disabled: bool)
Mark this request as having auth explicitly disabled.
Sourcepub fn decompress(&self) -> Option<bool>
pub fn decompress(&self) -> Option<bool>
Returns the per-request decompression override, if set.
Some(true): force decompression onSome(false): force decompression offNone: use client-level setting
Sourcepub fn set_decompress(&mut self, decompress: Option<bool>)
pub fn set_decompress(&mut self, decompress: Option<bool>)
Set the per-request decompression override.
Sourcepub fn max_decoded_body_size(&self) -> Option<usize>
pub fn max_decoded_body_size(&self) -> Option<usize>
Returns the per-request decoded response body size limit, if set.
None means the client-level setting is used.
Sourcepub fn set_max_decoded_body_size(&mut self, max: Option<usize>)
pub fn set_max_decoded_body_size(&mut self, max: Option<usize>)
Set the per-request decoded response body size limit.
Sourcepub fn max_decompression_ratio(&self) -> Option<f64>
pub fn max_decompression_ratio(&self) -> Option<f64>
Returns the per-request decompression ratio limit, if set.
None means the client-level setting is used.
Sourcepub fn set_max_decompression_ratio(&mut self, ratio: Option<f64>)
pub fn set_max_decompression_ratio(&mut self, ratio: Option<f64>)
Set the per-request decompression ratio limit.
Sourcepub fn retry(&self) -> Option<&RetryPolicy>
pub fn retry(&self) -> Option<&RetryPolicy>
Returns the per-request retry policy override, if set.
Only available with the logical-retry feature.
Sourcepub fn set_retry(&mut self, retry: Option<RetryPolicy>)
pub fn set_retry(&mut self, retry: Option<RetryPolicy>)
Set the per-request retry policy override.
Only available with the logical-retry feature.
Sourcepub fn transport_hints(&self) -> &TransportHints
pub fn transport_hints(&self) -> &TransportHints
Returns a reference to the transport hints for this request.
Sourcepub fn set_transport_hints(&mut self, hints: TransportHints)
pub fn set_transport_hints(&mut self, hints: TransportHints)
Set the transport hints for this request.
Sourcepub fn proxied_target(&self) -> Option<&ResolvedTarget>
pub fn proxied_target(&self) -> Option<&ResolvedTarget>
Returns the caller-supplied physical destination for a proxied request, if configured.
Sourcepub fn set_proxied_target(&mut self, target: Option<ResolvedTarget>)
pub fn set_proxied_target(&mut self, target: Option<ResolvedTarget>)
Set the caller-supplied physical destination for a proxied request.