aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-08-07 23:20:07 +0200
committerHarald Eilertsen <haraldei@anduin.net>2018-08-07 23:20:07 +0200
commit2a05b5a40a822f52ffcd1377aad9285d15da4d9f (patch)
treefd2faa169affb29a1a76c4e0780b9ad66b6a7e24 /src
parent540f8e4dd046ba37bd692fe96b15df4fe5ddec4c (diff)
downloadrust-zotapi-2a05b5a40a822f52ffcd1377aad9285d15da4d9f.tar.gz
rust-zotapi-2a05b5a40a822f52ffcd1377aad9285d15da4d9f.tar.bz2
rust-zotapi-2a05b5a40a822f52ffcd1377aad9285d15da4d9f.zip
Refactor generating target url
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c2d77ee..e02f38a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -17,7 +17,8 @@ pub struct Client {
impl Client {
pub fn channel_stream(&self) -> String {
- let mut res = self.inner.get(&self.channel_stream_url())
+ let url = self.url(ZOTAPI_CHANNEL_STREAM_PATH);
+ let mut res = self.inner.get(&url)
.header(Accept(vec![qitem(mime::APPLICATION_JSON)]))
.basic_auth(self.user.clone(), Some(self.pw.clone()))
.send()
@@ -28,8 +29,8 @@ impl Client {
body
}
- fn channel_stream_url(&self) -> String {
- self.base_url.clone() + ZOTAPI_CHANNEL_STREAM_PATH
+ fn url(&self, path: &str) -> String {
+ self.base_url.clone() + path
}
}