atomic_lti/url.rs
1use crate::errors::AtomicError;
2use url::Url;
3
4// Returns the host from a URL string
5pub fn parse_host(url: &str) -> Result<String, AtomicError> {
6 let config_url = Url::parse(url).map_err(|e| AtomicError::Internal(e.to_string()))?;
7 let host = config_url
8 .host_str()
9 .ok_or(AtomicError::Internal("No host found in URL".to_string()))?;
10 Ok(host.to_string())
11}