From 352dd535e0386d899e816ac5f597e583d1ade768 Mon Sep 17 00:00:00 2001
From: FxQnLr <felixquinn03@gmail.com>
Date: Wed, 10 Apr 2024 12:06:45 +0200
Subject: Closes #8. 0.4.0 seems to work

---
 src/requests/device.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'src/requests/device.rs')

diff --git a/src/requests/device.rs b/src/requests/device.rs
index 7583406..2606579 100644
--- a/src/requests/device.rs
+++ b/src/requests/device.rs
@@ -7,7 +7,7 @@ pub async fn put(
     broadcast_addr: String,
     ip: String,
 ) -> Result<(), Error> {
-    let url = format_url(config, "device", &Protocols::Http);
+    let url = format_url(config, "device", &Protocols::Http, None);
     println!("{url}");
     let res = reqwest::Client::new()
         .put(url)
@@ -25,9 +25,8 @@ pub async fn put(
 
 pub async fn get(config: &Config, id: String) -> Result<(), Error> {
     let res = reqwest::Client::new()
-        .get(format_url(config, "device", &Protocols::Http))
+        .get(format_url(config, "device", &Protocols::Http, Some(&id)))
         .headers(default_headers(config)?)
-        .body(format!(r#"{{"id": "{id}"}}"#))
         .send()
         .await?;
 
@@ -44,7 +43,7 @@ pub async fn post(
     ip: String,
 ) -> Result<(), Error> {
     let res = reqwest::Client::new()
-        .post(format_url(config, "device", &Protocols::Http))
+        .post(format_url(config, "device", &Protocols::Http, None))
         .headers(default_headers(config)?)
         .body(format!(
             r#"{{"id": "{id}", "mac": "{mac}", "broadcast_addr": "{broadcast_addr}", "ip": "{ip}"}}"#,
-- 
cgit v1.2.3