[][src]Struct anneal::ResponseExamine

pub struct ResponseExamine { /* fields omitted */ }

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

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

impl<T> UnsafeAny for T where
    T: Any