apimock-routing 5.1.2

Routing model for apimock: rule sets, request matching, and read-only views for GUI tooling.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{rule_set::prefix::Prefix, util::http::normalize_url_path};

/// url path merged with prefix and then normalized
pub fn url_path_with_prefix(url_path: &str, rule_set_prefix: Option<&Prefix>) -> String {
    let url_path_prefix = if let Some(prefix) = rule_set_prefix {
        if let Some(url_path_prefix) = prefix.url_path_prefix.as_ref() {
            Some(url_path_prefix.as_str())
        } else {
            None
        }
    } else {
        None
    };

    normalize_url_path(url_path, url_path_prefix)
}