autopulse_utils/
get_url.rs

1use std::borrow::Cow;
2
3pub fn get_url(url: &str) -> anyhow::Result<url::Url> {
4    let url: Cow<str> = if url.ends_with('/') {
5        Cow::Borrowed(url)
6    } else {
7        format!("{url}/").into()
8    };
9    url::Url::parse(&url).map_err(Into::into)
10}