deps: update url to 1

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Igor Gnatenko
2018-07-25 22:50:45 +02:00
parent e634d3f139
commit 78cefeab47
5 changed files with 33 additions and 29 deletions

View File

@@ -20,7 +20,7 @@ rustls = "0.9.0"
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
url = "0.5"
url = "1"
[dev-dependencies]
getopts = "0.2"

View File

@@ -87,13 +87,14 @@ impl<C> DeviceFlow<C>
// note: cloned() shouldn't be needed, see issue
// https://github.com/servo/rust-url/issues/81
let req = form_urlencoded::serialize(&[("client_id", &self.application_secret.client_id),
("scope",
&scopes.into_iter()
.map(|s| s.as_ref())
.intersperse(" ")
.collect::<String>()
)]);
let req = form_urlencoded::Serializer::new(String::new())
.extend_pairs(&[("client_id", &self.application_secret.client_id),
("scope", &scopes
.into_iter()
.map(|s| s.as_ref())
.intersperse(" ")
.collect::<String>())])
.finish();
// note: works around bug in rustlang
// https://github.com/rust-lang/rust/issues/22252
@@ -182,11 +183,12 @@ impl<C> DeviceFlow<C>
}
// We should be ready for a new request
let req = form_urlencoded::serialize(&[("client_id", &self.application_secret.client_id[..]),
("client_secret", &self.application_secret.client_secret),
("code", &self.device_code),
("grant_type",
"http://oauth.net/grant_type/device/1.0")]);
let req = form_urlencoded::Serializer::new(String::new())
.extend_pairs(&[("client_id", &self.application_secret.client_id[..]),
("client_secret", &self.application_secret.client_secret),
("code", &self.device_code),
("grant_type", "http://oauth.net/grant_type/device/1.0")])
.finish();
let json_str: String = match self.client
.borrow_mut()

View File

@@ -52,7 +52,7 @@ fn build_authentication_request_url<'a, T, I>(auth_uri: &str,
format!("&client_id={}", client_id)]
.into_iter()
.fold(url, |mut u, param| {
u.push_str(&percent_encode(param.as_ref(), QUERY_ENCODE_SET));
u.push_str(&percent_encode(param.as_ref(), QUERY_ENCODE_SET).to_string());
u
})
}
@@ -221,14 +221,13 @@ impl<C> InstalledFlow<C>
Some(p) => redirect_uri = format!("http://localhost:{}", p),
}
let body = form_urlencoded::serialize(vec![("code".to_string(), authcode.to_string()),
("client_id".to_string(),
appsecret.client_id.clone()),
("client_secret".to_string(),
appsecret.client_secret.clone()),
("redirect_uri".to_string(), redirect_uri),
("grant_type".to_string(),
"authorization_code".to_string())]);
let body = form_urlencoded::Serializer::new(String::new())
.extend_pairs(vec![("code".to_string(), authcode.to_string()),
("client_id".to_string(), appsecret.client_id.clone()),
("client_secret".to_string(), appsecret.client_secret.clone()),
("redirect_uri".to_string(), redirect_uri),
("grant_type".to_string(), "authorization_code".to_string())])
.finish();
let result: Result<client::Response, hyper::Error> = self.client
.borrow_mut()

View File

@@ -64,10 +64,12 @@ impl<C> RefreshFlow<C>
return &self.result;
}
let req = form_urlencoded::serialize(&[("client_id", client_secret.client_id.as_ref()),
("client_secret", client_secret.client_secret.as_ref()),
("refresh_token", refresh_token),
("grant_type", "refresh_token")]);
let req = form_urlencoded::Serializer::new(String::new())
.extend_pairs(&[("client_id", client_secret.client_id.as_ref()),
("client_secret", client_secret.client_secret.as_ref()),
("refresh_token", refresh_token),
("grant_type", "refresh_token")])
.finish();
let json_str: String = match self.client
.borrow_mut()

View File

@@ -220,9 +220,10 @@ impl<'a, C> ServiceAccountAccess<C>
let signed = try!(JWT::new(claims)
.sign(self.key.private_key.as_ref().unwrap()));
let body = form_urlencoded::serialize(vec![("grant_type".to_string(),
GRANT_TYPE.to_string()),
("assertion".to_string(), signed)]);
let body = form_urlencoded::Serializer::new(String::new())
.extend_pairs(vec![("grant_type".to_string(), GRANT_TYPE.to_string()),
("assertion".to_string(), signed)])
.finish();
let mut response = String::new();
let mut result = try!(self.client