Skip to main content

ResponseAssert

Trait ResponseAssert 

Source
pub trait ResponseAssert {
    // Required methods
    fn assert_status(&self, code: u16) -> &Self;
    fn json<T>(&self) -> T
       where T: DeserializeOwned;
    fn json_value(&self) -> Value;
}
Expand description

Fluent assertions for HTTP responses in tests.

Required Methods§

Source

fn assert_status(&self, code: u16) -> &Self

Panic unless status matches code.

Source

fn json<T>(&self) -> T

Deserialize buffered JSON body; panics on failure.

Source

fn json_value(&self) -> Value

Parse buffered body as serde_json::Value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§