Trait salvo_core::test::ResponseExt

source ·
pub trait ResponseExt {
    // Required methods
    fn take_string(&mut self) -> impl Future<Output = Result<String>> + Send;
    fn take_json<T: DeserializeOwned>(
        &mut self
    ) -> impl Future<Output = Result<T>> + Send;
    fn take_string_with_charset(
        &mut self,
        content_type: Option<&Mime>,
        charset: &str,
        compress: Option<&str>
    ) -> impl Future<Output = Result<String>>;
    fn take_bytes(
        &mut self,
        content_type: Option<&Mime>
    ) -> impl Future<Output = Result<Bytes>> + Send;
}
Available on crate feature test only.
Expand description

More utils functions for response.

Required Methods§

source

fn take_string(&mut self) -> impl Future<Output = Result<String>> + Send

Take body as String from response.

source

fn take_json<T: DeserializeOwned>( &mut self ) -> impl Future<Output = Result<T>> + Send

Take body as deserialize it to type T instance.

source

fn take_string_with_charset( &mut self, content_type: Option<&Mime>, charset: &str, compress: Option<&str> ) -> impl Future<Output = Result<String>>

Take body as String from response with charset.

source

fn take_bytes( &mut self, content_type: Option<&Mime> ) -> impl Future<Output = Result<Bytes>> + Send

Take all body bytes. If body is none, it will creates and returns a new Bytes.

Object Safety§

This trait is not object safe.

Implementors§