fn build_endpoint(agent_endpoint: &str, version: &str) -> Result<Uri, TraceError> {
        // build agent endpoint based on version
        let mut endpoint = agent_endpoint
            .parse::<Url>()
            .map_err::<Error, _>(Into::into)?;
        let mut paths = endpoint
            .path_segments()
            .map(|c| c.filter(|s| !s.is_empty()).collect::<Vec<_>>())
            .unwrap_or_default();
        paths.push(version);

        let path_str = paths.join("/");
        endpoint.set_path(path_str.as_str());

        Ok(endpoint.as_str().parse().map_err::<Error, _>(Into::into)?)
    }
// parse the endpoint and append the path based on versions.
// keep the query and host the same.
parse the endpoint and append the path based on versions.
keep the query and host the same.
parse the endpoint and append the path based on versions . keep the query and host the same .
fn build_endpoint(agent_endpoint: &str, version: &str) -> Result<Uri, TraceError> {
        // build agent endpoint based on version
        let mut endpoint = agent_endpoint
            .parse::<Url>()
            .map_err::<Error, _>(Into::into)?;
        let mut paths = endpoint
            .path_segments()
            .map(|c| c.filter(|s| !s.is_empty()).collect::<Vec<_>>())
            .unwrap_or_default();
        paths.push(version);
        let path_str = paths.join("/");
        endpoint.set_path(path_str.as_str());
        Ok(endpoint.as_str().parse().map_err::<Error, _>(Into::into)?)
    }
fn build_endpoint ( agent_endpoint : & str , version : & str ) -> Result < Uri , TraceError > { // build agent endpoint based on version let mut endpoint = agent_endpoint . parse :: < Url > ( ) . map_err :: < Error , _ > ( Into :: into ) ? ; let mut paths = endpoint . path_segments ( ) . map ( | c | c . filter ( | s | ! s . is_empty ( ) ) . collect :: < Vec < _ > > ( ) ) . unwrap_or_default ( ) ; paths . push ( version ) ; let path_str = paths . join ( " " ) ; endpoint . set_path ( path_str . as_str ( ) ) ; Ok ( endpoint . as_str ( ) . parse ( ) . map_err :: < Error , _ > ( Into :: into ) ? ) }
parse the endpoint and append the path based on versions.
parse the endpoint and append the path based on versions .
agent_endpoint
&str
version
&str
agent_endpoint
&str
version
&str