Last active
March 20, 2018 16:53
-
-
Save Kroisse/e57d457e6c3c641f38df683e83c4f5d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn eternal_pain<'a>( | |
&self, | |
handle: &'a Handle, | |
code: &str, | |
redirect_uri: Option<&str>, | |
) -> impl Future<Item=Output, Error=failure::Error> + 'a { | |
future::result::<_, Error>( | |
self.build_request_uri(code, redirect_uri) | |
).and_then(move |uri| { | |
Client::new(&handle).get(uri).map_err(From::from) | |
}).and_then(|res| { | |
res.body().concat2().map_err(From::from) | |
}).and_then(|body| { | |
serde_json::from_slice(&body).map_err(From::from) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment