diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/connector/connectors/httpconnector.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/client/connector/connectors/httpconnector.rs b/src/client/connector/connectors/httpconnector.rs index 2bdb36a..6d501cc 100644 --- a/src/client/connector/connectors/httpconnector.rs +++ b/src/client/connector/connectors/httpconnector.rs @@ -1,24 +1,22 @@ -use std::net::AddrParseError; - use crate::connector::*; -pub(crate) struct HTTPConnector<'a> { +pub(crate) struct HTTPConnector { prev: String, - url: &'a str, + url: reqwest::Url, channel: Channel<Self>, } -impl<'a> HTTPConnector<'a> { - pub fn new(url: &'a str) -> Result<Self, AddrParseError> { +impl HTTPConnector { + pub fn new(url: &str) -> Result<Self, url::ParseError> { Ok(Self { prev: String::new(), - url, + url: reqwest::Url::parse(url)?, channel: Channel::new(), }) } } -impl Connection for HTTPConnector<'_> { +impl Connection for HTTPConnector { type Err = reqwest::Error; fn test_connection(&self) -> std::result::Result<bool, reqwest::Error> { @@ -26,7 +24,7 @@ impl Connection for HTTPConnector<'_> { } async fn update(&self) -> Option<Result<Self::Success, Self::Err>> { - let res = match reqwest::get(self.url).await { + let res = match reqwest::get(self.url.clone()).await { Ok(resp) => match resp.text().await { Ok(text) => text, Err(e) => return Some(Err(e)), |
