[][src]Function plex_api::set_http_client

pub fn set_http_client(
    c: Client
) -> Result<(), PoisonError<RwLockWriteGuard<'static, Client>>>

A method to set custom HTTP-client, e.g. to change request timeout or to set a proxy.

Error would be returned if RwLock had been poisoned.

Examples

use plex_api::set_http_client;
use reqwest::{Client, Proxy};
use std::time::Duration;

set_http_client(Client::builder()
                    .timeout(Duration::from_secs(1))
                    .proxy(Proxy::http("http://example.com").expect("Proxy failed"))
                    .build()
                    .expect("Build failed")
).expect("Mutex poisoned");