Skip to main content

ResponseExt

Trait ResponseExt 

Source
pub trait ResponseExt {
    // Required methods
    fn assert_status(&self, expected: StatusCode) -> &Self;
    fn assert_success(&self) -> &Self;
    fn assert_client_error(&self) -> &Self;
    fn assert_server_error(&self) -> &Self;
    fn assert_ok(&self) -> &Self;
    fn assert_created(&self) -> &Self;
    fn assert_no_content(&self) -> &Self;
    fn assert_bad_request(&self) -> &Self;
    fn assert_unauthorized(&self) -> &Self;
    fn assert_forbidden(&self) -> &Self;
    fn assert_not_found(&self) -> &Self;
}
Expand description

Extension trait for Response assertions

Required Methods§

Source

fn assert_status(&self, expected: StatusCode) -> &Self

Assert status code

Source

fn assert_success(&self) -> &Self

Assert 2xx success

Source

fn assert_client_error(&self) -> &Self

Assert 4xx client error

Source

fn assert_server_error(&self) -> &Self

Assert 5xx server error

Source

fn assert_ok(&self) -> &Self

Assert specific status codes

Source

fn assert_created(&self) -> &Self

Assert that the response status is 201 Created.

Source

fn assert_no_content(&self) -> &Self

Assert that the response status is 204 No Content.

Source

fn assert_bad_request(&self) -> &Self

Assert that the response status is 400 Bad Request.

Source

fn assert_unauthorized(&self) -> &Self

Assert that the response status is 401 Unauthorized.

Source

fn assert_forbidden(&self) -> &Self

Assert that the response status is 403 Forbidden.

Source

fn assert_not_found(&self) -> &Self

Assert that the response status is 404 Not Found.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§