pub struct ClientResponse { /* private fields */ }Expand description
Client Response
Implementations§
Source§impl ClientResponse
impl ClientResponse
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Get the status from the server.
Sourcepub fn header<N: AsName>(&self, name: N) -> Option<&HeaderValue>
pub fn header<N: AsName>(&self, name: N) -> Option<&HeaderValue>
Returns a reference to the header value.
Sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Returns mutable response’s headers.
Sourcepub fn set_payload(&self, payload: Payload)
pub fn set_payload(&self, payload: Payload)
Set a body and return previous body value
Sourcepub fn take_payload(&self) -> Payload
pub fn take_payload(&self) -> Payload
Get response’s payload
Sourcepub fn extensions(&self) -> Ref<'_, Extensions>
pub fn extensions(&self) -> Ref<'_, Extensions>
Request extensions
Sourcepub fn extensions_mut(&self) -> RefMut<'_, Extensions>
pub fn extensions_mut(&self) -> RefMut<'_, Extensions>
Mutable reference to a the request’s extensions
Source§impl ClientResponse
impl ClientResponse
Sourcepub fn body(&self) -> MessageBody ⓘ
pub fn body(&self) -> MessageBody ⓘ
Loads http response’s body.
Sourcepub fn json<T: DeserializeOwned>(&self) -> JsonBody<T> ⓘ
pub fn json<T: DeserializeOwned>(&self) -> JsonBody<T> ⓘ
Loads and parse application/json encoded body.
Return JsonBody<T> future. It resolves to a T value.
Returns error:
- content type is not
application/json - content length is greater than 256k
Trait Implementations§
Source§impl Debug for ClientResponse
impl Debug for ClientResponse
Source§impl HttpMessage for ClientResponse
impl HttpMessage for ClientResponse
Load request cookies.
Source§fn message_headers(&self) -> &HeaderMap
fn message_headers(&self) -> &HeaderMap
Read the message headers.
Source§fn message_extensions(&self) -> Ref<'_, Extensions>
fn message_extensions(&self) -> Ref<'_, Extensions>
Request’s extensions container
Source§fn message_extensions_mut(&self) -> RefMut<'_, Extensions>
fn message_extensions_mut(&self) -> RefMut<'_, Extensions>
Mutable reference to a the request’s extensions container
Source§fn content_type(&self) -> &str
fn content_type(&self) -> &str
Read the request content type. If request does not contain
Content-Type header, empty str get returned.
Source§fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
Get content type encoding Read more
Source§fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
Convert the request content type to a known mime type.
Return request cookie.
Source§impl Stream for ClientResponse
impl Stream for ClientResponse
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