Commit 9bc0da8c authored by Ben Boeckel's avatar Ben Boeckel
Browse files

gitlab: make a non-SSL constructor

parent 502a0268
......@@ -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