Trait AnyBlockingResponse

Source
pub trait AnyBlockingResponse:
    Read
    + Any
    + Send
    + Sync
    + 'static {
    // Required methods
    fn describe(&self, f: &mut Formatter<'_>) -> Result;
    fn status(&self) -> u16;
    fn content_length(&self) -> Option<u64>;
    fn get_header(&self, header: &str) -> Result<Vec<String>>;
    fn text(&mut self) -> Result<String>;
    fn bytes(&mut self) -> Result<Vec<u8>>;
}
Available on crate feature blocking only.
Expand description

Trait for type-erased blocking HTTP responses.

Automatically implemented for types implementing BlockingResponse. It extends io::Read to allow streaming the response body.

Required Methods§

Source

fn describe(&self, f: &mut Formatter<'_>) -> Result

Provides a textual description of this response.

Source

fn status(&self) -> u16

Returns the HTTP status code of this response.

Source

fn content_length(&self) -> Option<u64>

Returns the content-length of the response body, if known.

Source

fn get_header(&self, header: &str) -> Result<Vec<String>>

Gets all values for the specified header.

Source

fn text(&mut self) -> Result<String>

Reads the response body as text.

Source

fn bytes(&mut self) -> Result<Vec<u8>>

Reads the response body as bytes.

Implementors§