Skip to main content

RequestConfig

Struct RequestConfig 

Source
pub struct RequestConfig {
Show 15 fields pub headers: Option<HashMap<String, String>>, pub cookies: Option<HashMap<String, String>>, pub params: Option<HashMap<String, String>>, pub timeout_secs: Option<u64>, pub follow_redirects: Option<FollowRedirects>, pub max_redirects: Option<usize>, pub retries: Option<u32>, pub retry_delay_secs: Option<u64>, pub proxy: Option<Proxy>, pub verify: Option<bool>, pub impersonate: Option<Impersonate>, pub stealthy_headers: Option<bool>, pub data: Option<Vec<u8>>, pub json: Option<Value>, pub auth: Option<(String, String)>,
}
Expand description

Per-request configuration overrides that take precedence over FetcherConfig defaults.

Every field is Option – when None, the corresponding value from the fetcher’s FetcherConfig is used instead. This lets you customize individual requests (e.g., use a different proxy or longer timeout) without affecting the global config.

Pass this to methods like Fetcher::get() and FetcherSession::post().

Fields§

§headers: Option<HashMap<String, String>>

Custom headers for this request. These are merged with the fetcher’s default headers, with per-request values taking precedence on name collisions.

§cookies: Option<HashMap<String, String>>

Cookies to send with this request, serialized into a single Cookie header. In a FetcherSession, the session’s cookie jar is used in addition to these.

§params: Option<HashMap<String, String>>

URL query parameters to append to the request URL.

§timeout_secs: Option<u64>

Request timeout override in seconds. When set, this replaces the fetcher’s default timeout for this single request.

§follow_redirects: Option<FollowRedirects>

Redirect policy override for this request.

§max_redirects: Option<usize>

Maximum redirects override for this request.

§retries: Option<u32>

Retry count override for this request. Set to Some(1) to disable retries.

§retry_delay_secs: Option<u64>

Retry delay override in seconds for this request.

§proxy: Option<Proxy>

Proxy override for this request. Overrides both the static proxy and the proxy rotator for this single request.

§verify: Option<bool>

TLS verification override for this request.

§impersonate: Option<Impersonate>

Browser impersonation override for this request.

§stealthy_headers: Option<bool>

Stealth headers override for this request.

§data: Option<Vec<u8>>

Raw request body bytes. Mutually exclusive with json – if both are set, json takes precedence.

§json: Option<Value>

JSON request body. Automatically serialized and sent with a Content-Type: application/json header. Takes precedence over data.

§auth: Option<(String, String)>

HTTP basic authentication credentials as (username, password).

Trait Implementations§

Source§

impl Debug for RequestConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for RequestConfig

Source§

fn default() -> RequestConfig

Returns the “default value” for a type. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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