Struct RequestBuilder
pub struct RequestBuilder<'a, S, Response> { /* private fields */ }http and std only.Expand description
A builder to construct the properties of a Request.
Constructed using HttpClientExt.
Implementations§
§impl<S, Body> RequestBuilder<'_, S, Response<Body>>
impl<S, Body> RequestBuilder<'_, S, Response<Body>>
pub fn header<K, V>(
self,
key: K,
value: V,
) -> RequestBuilder<'_, S, Response<Body>>where
K: IntoHeaderName,
V: IntoHeaderValue,
pub fn header<K, V>(
self,
key: K,
value: V,
) -> RequestBuilder<'_, S, Response<Body>>where
K: IntoHeaderName,
V: IntoHeaderValue,
Add a Header to this Request.
pub fn typed_header<H>(self, header: H) -> RequestBuilder<'_, S, Response<Body>>where
H: HeaderEncode,
pub fn typed_header<H>(self, header: H) -> RequestBuilder<'_, S, Response<Body>>where
H: HeaderEncode,
Add a typed HeaderEncode to this Request.
pub fn headers(
self,
headers: HeaderMap,
) -> RequestBuilder<'_, S, Response<Body>>
pub fn headers( self, headers: HeaderMap, ) -> RequestBuilder<'_, S, Response<Body>>
pub fn overwrite_header<K, V>(
self,
key: K,
value: V,
) -> RequestBuilder<'_, S, Response<Body>>where
K: IntoHeaderName,
V: IntoHeaderValue,
pub fn overwrite_header<K, V>(
self,
key: K,
value: V,
) -> RequestBuilder<'_, S, Response<Body>>where
K: IntoHeaderName,
V: IntoHeaderValue,
Overwrite a Header to this Request.
pub fn overwrite_typed_header<H>(
self,
header: H,
) -> RequestBuilder<'_, S, Response<Body>>where
H: HeaderEncode,
pub fn overwrite_typed_header<H>(
self,
header: H,
) -> RequestBuilder<'_, S, Response<Body>>where
H: HeaderEncode,
Overwrite a typed HeaderEncode to this Request.
pub fn auth(
self,
credentials: impl Credentials,
) -> RequestBuilder<'_, S, Response<Body>>
pub fn auth( self, credentials: impl Credentials, ) -> RequestBuilder<'_, S, Response<Body>>
Enable HTTP authentication.
pub fn extension<T>(self, extension: T) -> RequestBuilder<'_, S, Response<Body>>where
T: Extension,
pub fn extension<T>(self, extension: T) -> RequestBuilder<'_, S, Response<Body>>where
T: Extension,
Adds an extension to this builder
pub fn extensions(&self) -> Option<&Extensions>
pub fn extensions(&self) -> Option<&Extensions>
Get access to the underlying Extensions
This function will return None if Extensions are not available,
or if this builder is in an error state
pub fn body<T>(self, body: T) -> RequestBuilder<'_, S, Response<Body>>
pub fn body<T>(self, body: T) -> RequestBuilder<'_, S, Response<Body>>
pub fn form<T>(self, form: &T) -> RequestBuilder<'_, S, Response<Body>>
pub fn form<T>(self, form: &T) -> RequestBuilder<'_, S, Response<Body>>
pub fn json<T>(self, json: &T) -> RequestBuilder<'_, S, Response<Body>>
pub fn json<T>(self, json: &T) -> RequestBuilder<'_, S, Response<Body>>
pub fn multipart(self, form: Form) -> RequestBuilder<'_, S, Response<Body>>
Available on crate feature multipart only.
pub fn multipart(self, form: Form) -> RequestBuilder<'_, S, Response<Body>>
multipart only.Set a multipart::Form as the body of this
Request.
Sets the Content-Type header to
multipart/form-data; boundary={boundary} and, when every part has a
known size, the Content-Length header. An existing Content-Type
header is overwritten.
pub fn octet_stream<T>(self, bytes: T) -> RequestBuilder<'_, S, Response<Body>>
pub fn octet_stream<T>(self, bytes: T) -> RequestBuilder<'_, S, Response<Body>>
pub fn version(self, version: Version) -> RequestBuilder<'_, S, Response<Body>>
pub fn version(self, version: Version) -> RequestBuilder<'_, S, Response<Body>>
pub async fn send_with_timeout(
self,
t: Duration,
) -> Result<Response<Body>, Box<dyn Error + Sync + Send>>
pub async fn send_with_timeout( self, t: Duration, ) -> Result<Response<Body>, Box<dyn Error + Sync + Send>>
Constructs the Request and sends it to the target Uri,
returning a Response with a timeout that aborts with an error if
the roundtrip does not complete in time.
Note that this does not apply to the collection of the response payload, if there is any at all. The roundtrip is considered complete after the response headers are received.
§Errors
This method fails if there was an error while sending Request.
Trait Implementations§
Auto Trait Implementations§
impl<'a, S, Response> !RefUnwindSafe for RequestBuilder<'a, S, Response>
impl<'a, S, Response> !UnwindSafe for RequestBuilder<'a, S, Response>
impl<'a, S, Response> Freeze for RequestBuilder<'a, S, Response>
impl<'a, S, Response> Send for RequestBuilder<'a, S, Response>where
S: Sync,
impl<'a, S, Response> Sync for RequestBuilder<'a, S, Response>where
S: Sync,
impl<'a, S, Response> Unpin for RequestBuilder<'a, S, Response>
impl<'a, S, Response> UnsafeUnpin for RequestBuilder<'a, S, Response>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writer§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writer§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writer§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writer§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer