pub struct Response { /* private fields */ }Expand description
A response, with the methods of reqwest’s Response that generated clients use.
Implementations§
Source§impl Response
impl Response
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
The status code.
Sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
The headers, to change.
Sourcepub async fn text(self) -> Result<String, Error>
pub async fn text(self) -> Result<String, Error>
Reads the body as text; bytes that are not UTF-8 become U+FFFD.
Sourcepub async fn json<T: DeserializeOwned>(self) -> Result<T, Error>
pub async fn json<T: DeserializeOwned>(self) -> Result<T, Error>
Reads the body as JSON.
Sourcepub fn bytes_stream(
self,
) -> impl Stream<Item = Result<Bytes, Error>> + Send + 'static
pub fn bytes_stream( self, ) -> impl Stream<Item = Result<Bytes, Error>> + Send + 'static
The body as a stream of chunks, as they arrive.
Sourcepub fn events(self) -> Events
pub fn events(self) -> Events
The body as server-sent events (text/event-stream), as they arrive. Events::json
decodes their data: as JSON. The status and the content type are not checked.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Response
impl !RefUnwindSafe for Response
impl !UnwindSafe for Response
impl Forget for Response
impl Move for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
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