Skip to main content

Request

Struct Request 

Source
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

Source

pub fn method(&self) -> &Method

Returns the HTTP method.

Source

pub fn url(&self) -> &Url

Returns the request URL.

Source

pub fn headers(&self) -> &Headers

Returns a reference to the request headers.

Source

pub fn headers_mut(&mut self) -> &mut Headers

Returns a mutable reference to the request headers.

Source

pub fn body(&self) -> &RequestBody

Returns the request body.

Source

pub fn set_body(&mut self, body: RequestBody)

Set the request body.

Source

pub fn version(&self) -> Version

Returns the HTTP version.

Source

pub fn set_version(&mut self, version: Version)

Set the HTTP version.

Source

pub fn timeout(&self) -> Option<&Timeout>

Returns the request timeout configuration, if set.

Source

pub fn set_timeout(&mut self, timeout: Option<Timeout>)

Set the request-level timeout.

Source

pub fn redirect(&self) -> Option<&RedirectPolicy>

Returns the request-level redirect policy override, if set.

Only available with the redirects feature.

Source

pub fn set_redirect(&mut self, redirect: Option<RedirectPolicy>)

Set the request-level redirect policy override.

Only available with the redirects feature.

Source

pub fn auth(&self) -> Option<&AuthScheme>

Returns a reference to the request-level auth override, if set.

Source

pub fn set_auth(&mut self, auth: Option<AuthScheme>)

Set the request-level auth override.

Source

pub fn is_auth_disabled(&self) -> bool

Returns whether auth has been explicitly disabled for this request.

Source

pub fn set_auth_disabled(&mut self, disabled: bool)

Mark this request as having auth explicitly disabled.

Source

pub fn decompress(&self) -> Option<bool>

Returns the per-request decompression override, if set.

  • Some(true): force decompression on
  • Some(false): force decompression off
  • None: use client-level setting
Source

pub fn set_decompress(&mut self, decompress: Option<bool>)

Set the per-request decompression override.

Source

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.

Source

pub fn set_max_decoded_body_size(&mut self, max: Option<usize>)

Set the per-request decoded response body size limit.

Source

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.

Source

pub fn set_max_decompression_ratio(&mut self, ratio: Option<f64>)

Set the per-request decompression ratio limit.

Source

pub fn retry(&self) -> Option<&RetryPolicy>

Returns the per-request retry policy override, if set.

Only available with the logical-retry feature.

Source

pub fn set_retry(&mut self, retry: Option<RetryPolicy>)

Set the per-request retry policy override.

Only available with the logical-retry feature.

Source

pub fn transport_hints(&self) -> &TransportHints

Returns a reference to the transport hints for this request.

Source

pub fn set_transport_hints(&mut self, hints: TransportHints)

Set the transport hints for this request.

Source

pub fn proxied_target(&self) -> Option<&ResolvedTarget>

Returns the caller-supplied physical destination for a proxied request, if configured.

Source

pub fn set_proxied_target(&mut self, target: Option<ResolvedTarget>)

Set the caller-supplied physical destination for a proxied request.

Trait Implementations§

Source§

impl Debug for Request

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more