diff options
author | FxQnLr <[email protected]> | 2024-04-10 12:06:45 +0200 |
---|---|---|
committer | FxQnLr <[email protected]> | 2024-04-10 12:06:45 +0200 |
commit | 352dd535e0386d899e816ac5f597e583d1ade768 (patch) | |
tree | 064522c02fb30b3804ee399fd2e77a3e10c3f289 /src/requests/device.rs | |
parent | 23aa75439c3ee60e22ce183853516ca3cdd13ff4 (diff) | |
download | webol-cli-352dd535e0386d899e816ac5f597e583d1ade768.tar webol-cli-352dd535e0386d899e816ac5f597e583d1ade768.tar.gz webol-cli-352dd535e0386d899e816ac5f597e583d1ade768.zip |
Closes #8. 0.4.0 seems to work
Diffstat (limited to 'src/requests/device.rs')
-rw-r--r-- | src/requests/device.rs | 7 |
1 files changed, 3 insertions, 4 deletions
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( | |||
7 | broadcast_addr: String, | 7 | broadcast_addr: String, |
8 | ip: String, | 8 | ip: String, |
9 | ) -> Result<(), Error> { | 9 | ) -> Result<(), Error> { |
10 | let url = format_url(config, "device", &Protocols::Http); | 10 | let url = format_url(config, "device", &Protocols::Http, None); |
11 | println!("{url}"); | 11 | println!("{url}"); |
12 | let res = reqwest::Client::new() | 12 | let res = reqwest::Client::new() |
13 | .put(url) | 13 | .put(url) |
@@ -25,9 +25,8 @@ pub async fn put( | |||
25 | 25 | ||
26 | pub async fn get(config: &Config, id: String) -> Result<(), Error> { | 26 | pub async fn get(config: &Config, id: String) -> Result<(), Error> { |
27 | let res = reqwest::Client::new() | 27 | let res = reqwest::Client::new() |
28 | .get(format_url(config, "device", &Protocols::Http)) | 28 | .get(format_url(config, "device", &Protocols::Http, Some(&id))) |
29 | .headers(default_headers(config)?) | 29 | .headers(default_headers(config)?) |
30 | .body(format!(r#"{{"id": "{id}"}}"#)) | ||
31 | .send() | 30 | .send() |
32 | .await?; | 31 | .await?; |
33 | 32 | ||
@@ -44,7 +43,7 @@ pub async fn post( | |||
44 | ip: String, | 43 | ip: String, |
45 | ) -> Result<(), Error> { | 44 | ) -> Result<(), Error> { |
46 | let res = reqwest::Client::new() | 45 | let res = reqwest::Client::new() |
47 | .post(format_url(config, "device", &Protocols::Http)) | 46 | .post(format_url(config, "device", &Protocols::Http, None)) |
48 | .headers(default_headers(config)?) | 47 | .headers(default_headers(config)?) |
49 | .body(format!( | 48 | .body(format!( |
50 | r#"{{"id": "{id}", "mac": "{mac}", "broadcast_addr": "{broadcast_addr}", "ip": "{ip}"}}"#, | 49 | r#"{{"id": "{id}", "mac": "{mac}", "broadcast_addr": "{broadcast_addr}", "ip": "{ip}"}}"#, |