rust-mediamtx-http-api 0.0.8

rust-mediamtx-http-api with optional rust native tls feature
Documentation
#[cfg(test)]
mod tests {

    use url::Url;

    const TEST_URL: &str = "127.0.0.1:9997";

    #[cfg(feature = "tls")]
    fn get_mediamtx_client(url_string: &str) -> crate::MediamtxHttpClient {
        crate::MediamtxHttpClient::new(
            Url::parse(url_string).unwrap(),
            Some(crate::TlsConfig {
                insecure: Some(true),
                private_chain_bytes: None,
            }),
            None,
        )
    }

    #[cfg(not(feature = "tls"))]
    fn get_mediamtx_client(url_string: &str) -> crate::MediamtxHttpClient {
        crate::MediamtxHttpClient::new(Url::parse(url_string).unwrap(), None)
    }

    #[tokio::test]
    #[cfg(not(feature = "tls"))]
    async fn test_http() {
        let url_string = String::from("http://") + TEST_URL;

        let client = get_mediamtx_client(&url_string);

        let response = client.get_global_config().await;
        println!("{:?}", response);
        let response = client.get_default_path().await;
        println!("{:?}", response);
        let response = client.get_paths_status().await;
        println!("{:?}", response);
        let response = client.get_paths_configs().await;
        println!("{:?}", response);
        assert!(response.is_ok());
    }
}