diff options
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/client.rs b/src/client.rs index 507f845..3a20133 100644 --- a/src/client.rs +++ b/src/client.rs @@ -28,7 +28,6 @@ use reqwest::{ StatusCode, }; use serde::Serialize; -use serde_urlencoded; use std::collections::BTreeMap; use std::io::Read; @@ -92,10 +91,10 @@ impl Client { } fn url<T>(&self, path: &str, args: &T) -> String - where T: Serialize + where T: Serialize + std::fmt::Debug { let r = self.base_url.clone() + path; - if let Ok(a) = serde_urlencoded::to_string(args) { + if let Ok(a) = serde_qs::to_string(dbg!(args)) { r + "?" + &a } else { @@ -104,7 +103,7 @@ impl Client { } pub fn fetch_stream<T>(&self, path: &str, args: &T) -> Result<String, Error> - where T: Serialize + where T: Serialize + std::fmt::Debug { let url = dbg!(self.url(path, args)); let res = self.inner.get(&url) @@ -116,14 +115,15 @@ impl Client { } pub fn post_data<T>(&self, path: &str, data: &T) -> Result<String, Error> - where T: Serialize, + where T: Serialize + std::fmt::Debug, { let url = dbg!(self.url(path, &())); - let res = self.inner.post(&url) + let res = dbg!(self.inner.post(&url) .header(ACCEPT, "application/json") .header(CONTENT_TYPE, "application/x-www-form-urlencoded") .basic_auth(self.user.clone(), Some(self.pw.clone())) - .form(&data) + .body(serde_qs::to_string(&data)?)) + //.form(&data)) .send()?; handle_result(res) |