Merge pull request #14 from programble/upkeep/url-hyper-bump
Update hyper 0.9.0, url 1.1.0
This commit is contained in:
commit
35268d1925
|
@ -2,51 +2,52 @@
|
|||
name = "inth-oauth2"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"chrono 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"chrono 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"yup-hyper-mock 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"yup-hyper-mock 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "0.4.0"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.2.21"
|
||||
version = "0.2.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cookie"
|
||||
version = "0.2.2"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"openssl 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "gdi32-sys"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -64,31 +65,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.8.0"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cookie 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -99,12 +111,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "0.1.15"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.9"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -135,50 +147,85 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num"
|
||||
version = "0.1.31"
|
||||
version = "0.1.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-iter 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-iter"
|
||||
version = "0.1.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.1.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.7.9"
|
||||
version = "0.7.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys-extras 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys-extras 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.7.9"
|
||||
version = "0.7.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"user32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys-extras"
|
||||
version = "0.7.9"
|
||||
version = "0.7.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gcc 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-verify"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"openssl 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -199,7 +246,7 @@ name = "rand"
|
|||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -222,7 +269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "0.7.0"
|
||||
version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -230,8 +277,8 @@ name = "serde_json"
|
|||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -256,9 +303,9 @@ name = "time"
|
|||
version = "0.1.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -294,36 +341,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "0.5.8"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "user32-sys"
|
||||
version = "0.1.2"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -333,10 +369,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "yup-hyper-mock"
|
||||
version = "1.3.2"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ default = ["serde"]
|
|||
|
||||
[dependencies]
|
||||
chrono = "0.2.17"
|
||||
hyper = "0.8.0"
|
||||
hyper = "0.9.0"
|
||||
rustc-serialize = "0.3.16"
|
||||
url = "0.5.0"
|
||||
url = "1.1.0"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "0.7.0"
|
||||
|
|
|
@ -4,7 +4,8 @@ use std::marker::PhantomData;
|
|||
|
||||
use hyper::{self, header, mime};
|
||||
use rustc_serialize::json::Json;
|
||||
use url::{form_urlencoded, Url};
|
||||
use url::Url;
|
||||
use url::form_urlencoded::Serializer;
|
||||
|
||||
use error::OAuth2Error;
|
||||
use provider::Provider;
|
||||
|
@ -80,21 +81,22 @@ impl<P: Provider> Client<P> {
|
|||
{
|
||||
let mut uri = try!(Url::parse(P::auth_uri()));
|
||||
|
||||
let mut query_pairs = vec![
|
||||
("response_type", "code"),
|
||||
("client_id", &self.client_id),
|
||||
];
|
||||
{
|
||||
let mut query = uri.query_pairs_mut();
|
||||
|
||||
query.append_pair("response_type", "code");
|
||||
query.append_pair("client_id", &self.client_id);
|
||||
|
||||
if let Some(ref redirect_uri) = self.redirect_uri {
|
||||
query_pairs.push(("redirect_uri", redirect_uri));
|
||||
query.append_pair("redirect_uri", redirect_uri);
|
||||
}
|
||||
if let Some(scope) = scope {
|
||||
query_pairs.push(("scope", scope));
|
||||
query.append_pair("scope", scope);
|
||||
}
|
||||
if let Some(state) = state {
|
||||
query_pairs.push(("state", state));
|
||||
query.append_pair("state", state);
|
||||
}
|
||||
}
|
||||
|
||||
uri.set_query_from_pairs(query_pairs.iter());
|
||||
|
||||
Ok(uri)
|
||||
}
|
||||
|
@ -102,14 +104,13 @@ impl<P: Provider> Client<P> {
|
|||
fn post_token<'a>(
|
||||
&'a self,
|
||||
http_client: &hyper::Client,
|
||||
mut body_pairs: Vec<(&str, &'a str)>
|
||||
mut body: Serializer<String>
|
||||
) -> Result<Json, ClientError> {
|
||||
if P::credentials_in_body() {
|
||||
body_pairs.push(("client_id", &self.client_id));
|
||||
body_pairs.push(("client_secret", &self.client_secret));
|
||||
body.append_pair("client_id", &self.client_id);
|
||||
body.append_pair("client_secret", &self.client_secret);
|
||||
}
|
||||
|
||||
let body = form_urlencoded::serialize(body_pairs);
|
||||
let auth_header = header::Authorization(
|
||||
header::Basic {
|
||||
username: self.client_id.clone(),
|
||||
|
@ -119,6 +120,7 @@ impl<P: Provider> Client<P> {
|
|||
let accept_header = header::Accept(vec![
|
||||
header::qitem(mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, vec![])),
|
||||
]);
|
||||
let body = body.finish();
|
||||
|
||||
let request = http_client.post(P::token_uri())
|
||||
.header(auth_header)
|
||||
|
@ -141,17 +143,20 @@ impl<P: Provider> Client<P> {
|
|||
/// Requests an access token using an authorization code.
|
||||
///
|
||||
/// See [RFC 6749, section 4.1.3](http://tools.ietf.org/html/rfc6749#section-4.1.3).
|
||||
pub fn request_token(&self, http_client: &hyper::Client, code: &str) -> Result<P::Token, ClientError> {
|
||||
let mut body_pairs = vec![
|
||||
("grant_type", "authorization_code"),
|
||||
("code", code),
|
||||
];
|
||||
pub fn request_token(
|
||||
&self,
|
||||
http_client: &hyper::Client,
|
||||
code: &str
|
||||
) -> Result<P::Token, ClientError> {
|
||||
let mut body = Serializer::new(String::new());
|
||||
body.append_pair("grant_type", "authorization_code");
|
||||
body.append_pair("code", code);
|
||||
|
||||
if let Some(ref redirect_uri) = self.redirect_uri {
|
||||
body_pairs.push(("redirect_uri", redirect_uri));
|
||||
body.append_pair("redirect_uri", redirect_uri);
|
||||
}
|
||||
|
||||
|
||||
let json = try!(self.post_token(http_client, body_pairs));
|
||||
let json = try!(self.post_token(http_client, body));
|
||||
let token = try!(P::Token::from_response(&json));
|
||||
Ok(token)
|
||||
}
|
||||
|
@ -167,15 +172,15 @@ impl<P: Provider> Client<P> where P::Token: Token<Refresh> {
|
|||
token: P::Token,
|
||||
scope: Option<&str>
|
||||
) -> Result<P::Token, ClientError> {
|
||||
let mut body_pairs = vec![
|
||||
("grant_type", "refresh_token"),
|
||||
("refresh_token", token.lifetime().refresh_token()),
|
||||
];
|
||||
let mut body = Serializer::new(String::new());
|
||||
body.append_pair("grant_type", "refresh_token");
|
||||
body.append_pair("refresh_token", token.lifetime().refresh_token());
|
||||
|
||||
if let Some(scope) = scope {
|
||||
body_pairs.push(("scope", scope));
|
||||
body.append_pair("scope", scope);
|
||||
}
|
||||
|
||||
let json = try!(self.post_token(http_client, body_pairs));
|
||||
let json = try!(self.post_token(http_client, body));
|
||||
let token = try!(P::Token::from_response_inherit(&json, &token));
|
||||
Ok(token)
|
||||
}
|
||||
|
@ -209,7 +214,7 @@ mod tests {
|
|||
let client = Client::<Test>::new(String::from("foo"), String::from("bar"), None);
|
||||
assert_eq!(
|
||||
"http://example.com/oauth2/auth?response_type=code&client_id=foo",
|
||||
client.auth_uri(None, None).unwrap().serialize()
|
||||
client.auth_uri(None, None).unwrap().as_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -222,7 +227,7 @@ mod tests {
|
|||
);
|
||||
assert_eq!(
|
||||
"http://example.com/oauth2/auth?response_type=code&client_id=foo&redirect_uri=http%3A%2F%2Fexample.com%2Foauth2%2Fcallback",
|
||||
client.auth_uri(None, None).unwrap().serialize()
|
||||
client.auth_uri(None, None).unwrap().as_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -231,7 +236,7 @@ mod tests {
|
|||
let client = Client::<Test>::new(String::from("foo"), String::from("bar"), None);
|
||||
assert_eq!(
|
||||
"http://example.com/oauth2/auth?response_type=code&client_id=foo&scope=baz",
|
||||
client.auth_uri(Some("baz"), None).unwrap().serialize()
|
||||
client.auth_uri(Some("baz"), None).unwrap().as_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -240,7 +245,7 @@ mod tests {
|
|||
let client = Client::<Test>::new(String::from("foo"), String::from("bar"), None);
|
||||
assert_eq!(
|
||||
"http://example.com/oauth2/auth?response_type=code&client_id=foo&state=baz",
|
||||
client.auth_uri(None, Some("baz")).unwrap().serialize()
|
||||
client.auth_uri(None, Some("baz")).unwrap().as_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,6 @@
|
|||
unused_extern_crates,
|
||||
unused_import_braces,
|
||||
unused_qualifications,
|
||||
unused_results,
|
||||
variant_size_differences
|
||||
)]
|
||||
|
||||
|
|
Loading…
Reference in New Issue