RequestBuilder

Struct RequestBuilder 

Source
pub struct RequestBuilder<'a, E> { /* private fields */ }
Expand description

A builder for a request to be sent to the upstream.

Implementations§

Source§

impl<'a, E> RequestBuilder<'a, E>
where E: ResponseExtractor + 'static, E::Output: 'static,

Source

pub fn extractor<T>(self, extractor: T) -> RequestBuilder<'a, T>

Sets the extractor to be used to extract only the necessary data from Response.

Source

pub fn extract_with<F, T>( self, function: F, ) -> RequestBuilder<'a, FnResponseExtractor<F>>
where F: FnOnce(&HttpCallResponse, &dyn ResponseBuffers) -> T,

Sets the extractor to be used to extract only the necessary data from Response.

Source

pub fn path(self, path: &'a str) -> Self

Sets the path to be used in the request.

Source

pub fn headers(self, headers: Vec<(&'a str, &'a str)>) -> Self

Sets the headers to be used in the request.

Source

pub fn body(self, body: &'a [u8]) -> Self

Sets the body to be used in the request.

Source

pub fn trailers(self, trailers: Vec<(&'a str, &'a str)>) -> Self

Sets the trailers to be used in the request.

Source

pub fn timeout(self, timeout: Duration) -> Self

Sets the timeout for the request.

Source

pub fn post(self) -> Request<E::Output>

Executes the request using the POST method.

Source

pub fn put(self) -> Request<E::Output>

Executes the request using the PUT method.

Source

pub fn get(self) -> Request<E::Output>

Executes the request using the GET method.

Source

pub fn options(self) -> Request<E::Output>

Executes the request using the OPTIONS method.

Source

pub fn delete(self) -> Request<E::Output>

Executes the request using the DELETE method.

Source

pub fn send(self, method: &str) -> Request<E::Output>

Executes the request using the provided method.

Trait Implementations§

Source§

impl<E: ResponseExtractor> ResponseExtractor for RequestBuilder<'_, E>

Source§

type Output = <E as ResponseExtractor>::Output

The output type
Source§

fn extract( self, event: &HttpCallResponse, buffers: &dyn ResponseBuffers, ) -> Self::Output

Extracts the Response from their low-level components

Auto Trait Implementations§

§

impl<'a, E> Freeze for RequestBuilder<'a, E>
where E: Freeze,

§

impl<'a, E> !RefUnwindSafe for RequestBuilder<'a, E>

§

impl<'a, E> !Send for RequestBuilder<'a, E>

§

impl<'a, E> !Sync for RequestBuilder<'a, E>

§

impl<'a, E> Unpin for RequestBuilder<'a, E>
where E: Unpin,

§

impl<'a, E> !UnwindSafe for RequestBuilder<'a, E>

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<C, T> Extract<T> for C
where T: FromContext<C>,

Source§

type Error = <T as FromContext<C>>::Error

Source§

fn extract(&self) -> Result<T, <C as Extract<T>>::Error>

Source§

fn extract_always(&self) -> T
where Self: Extract<T, Error = Infallible>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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 = 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.