Skip to main content

FetchOptions

Struct FetchOptions 

Source
pub struct FetchOptions {
Show 13 fields pub allowed_hosts: Option<Vec<String>>, pub allow_private_networks: bool, pub private_hosts: Vec<String>, pub max_response_bytes: u64, pub max_concurrent: usize, pub max_per_request: u32, pub connect_timeout: Duration, pub timeout: Duration, pub pool_max_idle_per_host: usize, pub max_retries: u32, pub proxy: Option<String>, pub no_proxy: bool, pub propagate_trace_context: bool,
}
Expand description

Policy and limits applied to every outbound fetch request.

None of this is reachable from Lua: a script declares intent (a timeout, a retry count) but cannot widen its own policy or uncap its budget.

Fields§

§allowed_hosts: Option<Vec<String>>

When set, only these exact host names may be fetched (compared case-insensitively; applies to every redirect hop).

§allow_private_networks: bool

Allow requests to loopback/private/link-local addresses. Off by default; enable for trusted internal aggregation.

§private_hosts: Vec<String>

Host names that may resolve to a private address while allow_private_networks stays off: the sidecar or the service next door, compared case-insensitively against the URL’s host and applied to every redirect hop.

§max_response_bytes: u64

Maximum response body size accumulated by resp:text() / resp:json(), in bytes.

§max_concurrent: usize

Maximum concurrent requests per await_all(...) call.

§max_per_request: u32

Maximum outbound requests one inbound request may make in total. 0 removes the cap.

§connect_timeout: Duration

How long to wait for a TCP/TLS connection to an upstream.

§timeout: Duration

Default total budget per outbound request.

§pool_max_idle_per_host: usize

Idle connections kept per upstream host.

§max_retries: u32

Ceiling on the retry.attempts a call may ask for.

§proxy: Option<String>

Explicit proxy URL; None uses the environment variables unless no_proxy is set.

§no_proxy: bool

Ignore the proxy environment variables.

§propagate_trace_context: bool

Forward a W3C traceparent derived from the inbound request id.

Trait Implementations§

Source§

impl Clone for FetchOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FetchOptions

Source§

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

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

impl Default for FetchOptions

Source§

fn default() -> Self

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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