Commit 981262b0 authored by Brad King's avatar Brad King 💬 Committed by Kitware Robot
Browse files

Merge topic 'non-ssl-ctor'

9bc0da8c

 gitlab: make a non-SSL constructor
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Brad King's avatarBrad King <brad.king@kitware.com>
Merge-request: !34
parents 502a0268 9bc0da8c
......@@ -59,9 +59,22 @@ impl Gitlab {
pub fn new<T: ToString>(host: &str, token: T) -> GitlabResult<Self> {
let base_url = try!(Url::parse(&format!("https://{}/api/v3/", host)));
Self::_new(host, token.to_string(), base_url)
}
/// Create a new non-SSL Gitlab API representation.
///
/// Errors out if `token` is invalid.
pub fn new_insecure<T: ToString>(host: &str, token: T) -> GitlabResult<Self> {
let base_url = try!(Url::parse(&format!("http://{}/api/v3/", host)));
Self::_new(host, token.to_string(), base_url)
}
fn _new(host: &str, token: String, base_url: Url) -> GitlabResult<Self> {
let api = Gitlab {
base_url: base_url,
token: token.to_string(),
token: token,
};
// Ensure the API is working.
......
Supports Markdown
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