Skip to main content

normalise_origin

Function normalise_origin 

Source
pub fn normalise_origin(raw: &str) -> Option<String>
Expand description

Reduce a configured public base URL to its origin (scheme://authority, no path, no trailing slash). None when it is not an http(s) URL with a usable authority.

use solid_pod_rs_server::scheme::normalise_origin;
assert_eq!(normalise_origin("https://pod.example/base/"), Some("https://pod.example".into()));
assert_eq!(normalise_origin("ftp://pod.example"), None);