get_origin_from_url

Function get_origin_from_url 

Source
pub fn get_origin_from_url(url: &str) -> Result<String, Error>
Expand description

Extracts the origin from a URL string.

The origin consists of the scheme and host components of the URL. For example, given “https://www.example.com/test”, this function returns “https://www.example.com”.

§Arguments

  • url - A string slice containing the URL to parse

§Returns

  • Result<String, anyhow::Error> - The origin string on success, or an error if URL parsing fails