summaryrefslogtreecommitdiff
path: root/src/client/connector/httpconnector.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/connector/httpconnector.rs')
-rw-r--r--src/client/connector/httpconnector.rs17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/client/connector/httpconnector.rs b/src/client/connector/httpconnector.rs
index d8c0027..a418b97 100644
--- a/src/client/connector/httpconnector.rs
+++ b/src/client/connector/httpconnector.rs
@@ -16,11 +16,7 @@ pub struct HTTPConnector {
}
impl HTTPConnector {
- pub fn new(
- pull_url: &str,
- ntfy_url: &str,
- ip_getter_url: &str,
- ) -> std::result::Result<Self, url::ParseError> {
+ pub fn new(pull_url: &str, ntfy_url: &str, ip_getter_url: &str) -> std::result::Result<Self, url::ParseError> {
Ok(Self {
network_enforcer: Executor::new(&NETWORK_T, ["on".to_string()]).unwrap(), // .unwrap() should never panic
prev: String::new(),
@@ -35,10 +31,7 @@ impl HTTPConnector {
}
#[allow(clippy::only_used_in_recursion)]
- fn handle_response<F: Fn() -> RequestBuilder>(
- &self,
- req: F,
- ) -> Result<<HTTPConnector as Connection>::Ok, <HTTPConnector as Connection>::Err> {
+ fn handle_response<F: Fn() -> RequestBuilder>(&self, req: F) -> Result<<HTTPConnector as Connection>::Ok, <HTTPConnector as Connection>::Err> {
match req().send() {
Ok(resp) => match resp.status() {
StatusCode::TOO_MANY_REQUESTS => {
@@ -84,11 +77,7 @@ impl Connection for HTTPConnector {
}
fn ntfy(&self, data: String) -> std::result::Result<(), Self::Err> {
- self.handle_response(|| {
- self.client
- .post(self.ntfy_url.as_str())
- .body(data.to_owned())
- })?;
+ self.handle_response(|| self.client.post(self.ntfy_url.as_str()).body(data.to_owned()))?;
Ok(())
}