Trait asserhttp::AsserhttpHeader[][src]

pub trait AsserhttpHeader<T> {
    fn expect_header<'a, K: Into<&'a str>, V: Into<&'a str>>(
        &mut self,
        key: K,
        value: V
    ) -> &mut T; }
Expand description

For assertions on http response headers

Required methods

Expects response header to be equal

  • key - expected header key
  • value - expected header value

Example

use asserhttp::*;

#[async_std::main]
async fn main() {
    isahc::get("http://localhost").unwrap().expect_header("content-type", "application/json");
    isahc::get("http://localhost").expect_header("content-type", "application/json");
    isahc::get_async("http://localhost").await.unwrap().expect_header("content-type", "application/json");
    isahc::get_async("http://localhost").await.expect_header("content-type", "application/json");

    surf::get("http://localhost").await.unwrap().expect_header("content-type", "application/json");
    surf::get("http://localhost").await.expect_header("content-type", "application/json");
}

Implementations on Foreign Types

Implementors