pub struct ClientResponse { /* private fields */ }Expand description
A wrapper type over the platform’s HTTP response type.
This abstracts over the inner reqwest::Response type and provides the original request
and a way to store state associated with the response.
On the web, it uses web_sys::Response instead of reqwest::Response to avoid pulling in
the entire reqwest crate and to support native browser APIs.
Implementations§
Source§impl ClientResponse
impl ClientResponse
pub fn status(&self) -> StatusCode
pub fn headers(&self) -> &HeaderMap
pub fn url(&self) -> &Url
pub fn content_length(&self) -> Option<u64>
pub async fn bytes(self) -> Result<Bytes, RequestError>
pub fn bytes_stream( self, ) -> impl Stream<Item = Result<Bytes, StreamingError>> + 'static + Unpin + Send
pub fn extensions(&self) -> &Extensions
pub fn extensions_mut(&mut self) -> &mut Extensions
pub async fn json<T: DeserializeOwned>(self) -> Result<T, RequestError>
pub async fn text(self) -> Result<String, RequestError>
Sourcepub fn make_parts(&self) -> Parts
pub fn make_parts(&self) -> Parts
Creates the http::response::Parts from this response.
Sourcepub fn into_parts(
self,
) -> (Parts, impl Stream<Item = Result<Bytes, StreamingError>>)
pub fn into_parts( self, ) -> (Parts, impl Stream<Item = Result<Bytes, StreamingError>>)
Consumes the response, returning the head and a stream of the body.
Auto Trait Implementations§
impl Freeze for ClientResponse
impl !RefUnwindSafe for ClientResponse
impl !Send for ClientResponse
impl !Sync for ClientResponse
impl Unpin for ClientResponse
impl !UnwindSafe for ClientResponse
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.