aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.rs
diff options
context:
space:
mode:
authorYour Name <you@example.com>2020-05-02 16:01:19 +0200
committerYour Name <you@example.com>2020-05-02 16:01:19 +0200
commiteb917c35008d32b3b27bf132b5f831f05888be54 (patch)
tree9e4373290471bc535a1bcdc23322cf290a30f456 /src/client.rs
parente95d9f86d2d9f2e689393f1e486b6250b2b075db (diff)
downloadrust-zotapi-eb917c35008d32b3b27bf132b5f831f05888be54.tar.gz
rust-zotapi-eb917c35008d32b3b27bf132b5f831f05888be54.tar.bz2
rust-zotapi-eb917c35008d32b3b27bf132b5f831f05888be54.zip
zotcli: Don't dump raw json response after post item.
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs
index 7a54825..c681b27 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -126,6 +126,14 @@ impl Client {
.header(ACCEPT, "application/json")
.basic_auth(self.user.clone(), Some(self.pw.clone()))
}
+
+ /// Return a RequestBuilder object that's set up with the correct
+ /// path and headers for performing a zot api post request.
+ pub fn post(&self, path: &str) -> reqwest::RequestBuilder {
+ self.inner.post(&self.url(path, &()))
+ .header(ACCEPT, "application/json")
+ .basic_auth(self.user.clone(), Some(self.pw.clone()))
+ }
}
// A common function for handling the response after a request.