[−][src]Struct anneal::ResponseExamine
Wraps a response for easier examination in unit tests
Methods
impl ResponseExamine
[src]
pub fn new(response: Response) -> ResponseExamine
[src]
Create a ResponseExamine
wrapping response
Panics
This reads the body of the response and will panic if a body exists but cannot be read
pub fn get_bytes(&self) -> Option<&[u8]>
[src]
Get a slice containing the bytes making up the body of the response, should the response have a body
pub fn get_string(&self) -> Result<String, ResponseError>
[src]
Try to decode the body of the request as a Utf-8 string
pub fn get_header<H: Header + HeaderFormat>(&self) -> Option<&H>
[src]
Get the given header from the response's header map
pub fn get_headers(&self) -> &Headers
[src]
Get the response's header map
pub fn get_extension<K: Key>(&self) -> Option<&K::Value>
[src]
Get the given extension from the response's extension map
pub fn get_extensions(&self) -> &TypeMap
[src]
Get the response's extension map
pub fn get_status(&self) -> Option<&Status>
[src]
Get the status code of the response
pub fn is_success(&self) -> bool
[src]
true
if the response has a status code and that status code indicates
success, false
otherwise.
pub fn get_json<T: DeserializeOwned>(&self) -> Result<T, ResponseError>
[src]
Try to decode the body of the request as a json encoded object of the given format
This will error if there is a content type header set and it's not Content-Type: application/json
pub fn get_cookies(&self) -> Result<CookieJar, ResponseError>
[src]
Get a cookie jar containing all cookies in the Cookie
header.
All cookies will be non-original and thus will show up in .delta()
.
This will error if there was no Cookie
header set.
Auto Trait Implementations
impl !Send for ResponseExamine
impl !Sync for ResponseExamine
impl Unpin for ResponseExamine
impl !UnwindSafe for ResponseExamine
impl !RefUnwindSafe for ResponseExamine
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> UnsafeAny for T where
T: Any,
T: Any,