stubr 0.2.0-alpha2

Wiremock implemented in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::convert::TryFrom;

use wiremock::matchers::{path, PathExactMatcher};

use super::HttpUrlDto;

impl TryFrom<&HttpUrlDto> for PathExactMatcher {
    type Error = anyhow::Error;

    fn try_from(http_url: &HttpUrlDto) -> anyhow::Result<Self> {
        http_url.url_path.as_ref()
            .map(|it| path(it.as_str()))
            .ok_or_else(|| anyhow::Error::msg("No 'urlPath'"))
    }
}