Commit 35b07e59 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'no-persist-client'

7c50baf8

 gitlab: do not persist the Client object
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Brad King's avatarBrad King <brad.king@kitware.com>
Merge-request: !61
parents b9c20ea2 7c50baf8
...@@ -28,7 +28,6 @@ use std::fmt::{self, Debug}; ...@@ -28,7 +28,6 @@ use std::fmt::{self, Debug};
/// ///
/// Separate users should use separate instances of this. /// Separate users should use separate instances of this.
pub struct Gitlab { pub struct Gitlab {
client: Client,
base_url: Url, base_url: Url,
token: String, token: String,
} }
...@@ -94,7 +93,6 @@ impl Gitlab { ...@@ -94,7 +93,6 @@ impl Gitlab {
let base_url = try!(Url::parse(&format!("{}://{}/api/v3/", protocol, host))); let base_url = try!(Url::parse(&format!("{}://{}/api/v3/", protocol, host)));
let api = Gitlab { let api = Gitlab {
client: try!(Client::new()),
base_url: base_url, base_url: base_url,
token: token, token: token,
}; };
...@@ -462,7 +460,7 @@ impl Gitlab { ...@@ -462,7 +460,7 @@ impl Gitlab {
V: AsRef<str>, V: AsRef<str>,
{ {
let full_url = try!(self._mk_url_with_param(url, param)); let full_url = try!(self._mk_url_with_param(url, param));
let req = self.client.get(full_url); let req = try!(Client::new()).get(full_url);
self._comm(req) self._comm(req)
} }
...@@ -476,7 +474,7 @@ impl Gitlab { ...@@ -476,7 +474,7 @@ impl Gitlab {
U: Serialize, U: Serialize,
{ {
let full_url = try!(self._mk_url(url)); let full_url = try!(self._mk_url(url));
let req = self.client.post(full_url).form(&param); let req = try!(Client::new()).post(full_url).form(&param);
self._comm(req) self._comm(req)
} }
...@@ -506,7 +504,7 @@ impl Gitlab { ...@@ -506,7 +504,7 @@ impl Gitlab {
let mut page_url = full_url.clone(); let mut page_url = full_url.clone();
page_url.query_pairs_mut() page_url.query_pairs_mut()
.extend_pairs(&[("page", page_str), ("per_page", per_page_str)]); .extend_pairs(&[("page", page_str), ("per_page", per_page_str)]);
let req = self.client.get(page_url); let req = try!(Client::new()).get(page_url);
let page: Vec<T> = try!(self._comm(req)); let page: Vec<T> = try!(self._comm(req));
let page_len = page.len(); let page_len = page.len();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment