diff options
| -rw-r--r-- | mullvad-api/src/access.rs | 2 | ||||
| -rw-r--r-- | mullvad-api/src/lib.rs | 2 | ||||
| -rw-r--r-- | mullvad-api/src/rest.rs | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/mullvad-api/src/access.rs b/mullvad-api/src/access.rs index 2c244d1513..276cc1f561 100644 --- a/mullvad-api/src/access.rs +++ b/mullvad-api/src/access.rs @@ -38,7 +38,7 @@ struct AccountState { impl AccessTokenStore { pub(crate) fn new(service: RequestServiceHandle) -> Self { - let factory = rest::RequestFactory::new(API.host.clone(), None); + let factory = rest::RequestFactory::new(&API.host, None); let (tx, rx) = mpsc::unbounded(); tokio::spawn(Self::service_requests(rx, service, factory)); Self { tx } diff --git a/mullvad-api/src/lib.rs b/mullvad-api/src/lib.rs index 6d9a91b4ae..91e2bc524a 100644 --- a/mullvad-api/src/lib.rs +++ b/mullvad-api/src/lib.rs @@ -341,7 +341,7 @@ impl Runtime { ) .await; let token_store = access::AccessTokenStore::new(service.clone()); - let factory = rest::RequestFactory::new(API.host.clone(), Some(token_store)); + let factory = rest::RequestFactory::new(&API.host, Some(token_store)); rest::MullvadRestHandle::new( service, diff --git a/mullvad-api/src/rest.rs b/mullvad-api/src/rest.rs index 8f4ec39731..f300b191e7 100644 --- a/mullvad-api/src/rest.rs +++ b/mullvad-api/src/rest.rs @@ -481,13 +481,13 @@ struct NewErrorResponse { #[derive(Clone)] pub struct RequestFactory { - hostname: String, + hostname: &'static str, token_store: Option<AccessTokenStore>, default_timeout: Duration, } impl RequestFactory { - pub fn new(hostname: String, token_store: Option<AccessTokenStore>) -> Self { + pub fn new(hostname: &'static str, token_store: Option<AccessTokenStore>) -> Self { Self { hostname, token_store, @@ -564,7 +564,7 @@ impl RequestFactory { .uri(uri) .header(header::USER_AGENT, HeaderValue::from_static(USER_AGENT)) .header(header::ACCEPT, HeaderValue::from_static("application/json")) - .header(header::HOST, self.hostname.clone()); + .header(header::HOST, HeaderValue::from_static(self.hostname)); let result = request.body(hyper::Body::empty())?; Ok(result) |
