Support reqwest 0.8.0
This commit is contained in:
parent
6e95eadd29
commit
baa8a783cf
|
@ -18,4 +18,4 @@ serde = "1.0.8"
|
||||||
serde_derive = "1.0.5"
|
serde_derive = "1.0.5"
|
||||||
serde_json = "1.0.2"
|
serde_json = "1.0.2"
|
||||||
url = "1.1.0"
|
url = "1.1.0"
|
||||||
reqwest = "0.7.3"
|
reqwest = "0.8.0"
|
||||||
|
|
|
@ -7,7 +7,7 @@ use inth_oauth2::Client;
|
||||||
use inth_oauth2::provider::GitHub;
|
use inth_oauth2::provider::GitHub;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let http_client = reqwest::Client::new().unwrap();
|
let http_client = reqwest::Client::new();
|
||||||
|
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
GitHub,
|
GitHub,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use inth_oauth2::Client;
|
||||||
use inth_oauth2::provider::google::{Installed, REDIRECT_URI_OOB};
|
use inth_oauth2::provider::google::{Installed, REDIRECT_URI_OOB};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let http_client = reqwest::Client::new().unwrap();
|
let http_client = reqwest::Client::new();
|
||||||
|
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
Installed,
|
Installed,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use inth_oauth2::Client;
|
||||||
use inth_oauth2::provider::google::Web;
|
use inth_oauth2::provider::google::Web;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let http_client = reqwest::Client::new().unwrap();
|
let http_client = reqwest::Client::new();
|
||||||
|
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
Web,
|
Web,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use inth_oauth2::Client;
|
||||||
use inth_oauth2::provider::Imgur;
|
use inth_oauth2::provider::Imgur;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let http_client = reqwest::Client::new().unwrap();
|
let http_client = reqwest::Client::new();
|
||||||
|
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
Imgur,
|
Imgur,
|
||||||
|
|
|
@ -128,7 +128,7 @@ impl<P: Provider> Client<P> {
|
||||||
]);
|
]);
|
||||||
let body = body.finish();
|
let body = body.finish();
|
||||||
|
|
||||||
let mut response = http_client.post(self.provider.token_uri().clone())?
|
let mut response = http_client.post(self.provider.token_uri().clone())
|
||||||
.header(auth_header)
|
.header(auth_header)
|
||||||
.header(accept_header)
|
.header(accept_header)
|
||||||
.header(header::ContentType::form_url_encoded())
|
.header(header::ContentType::form_url_encoded())
|
||||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -66,7 +66,7 @@
|
||||||
//! let mut code = String::new();
|
//! let mut code = String::new();
|
||||||
//! io::stdin().read_line(&mut code).unwrap();
|
//! io::stdin().read_line(&mut code).unwrap();
|
||||||
//!
|
//!
|
||||||
//! let http = reqwest::Client::new().unwrap();
|
//! let http = reqwest::Client::new();
|
||||||
//! let token = client.request_token(&http, code.trim()).unwrap();
|
//! let token = client.request_token(&http, code.trim()).unwrap();
|
||||||
//! println!("{}", token.access_token());
|
//! println!("{}", token.access_token());
|
||||||
//! # }
|
//! # }
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
//! # use inth_oauth2::provider::google::Installed;
|
//! # use inth_oauth2::provider::google::Installed;
|
||||||
//! # fn main() {
|
//! # fn main() {
|
||||||
//! # let client = Client::new(Installed, String::new(), String::new(), None);
|
//! # let client = Client::new(Installed, String::new(), String::new(), None);
|
||||||
//! # let http = reqwest::Client::new().unwrap();
|
//! # let http = reqwest::Client::new();
|
||||||
//! # let token = client.request_token(&http, "").unwrap();
|
//! # let token = client.request_token(&http, "").unwrap();
|
||||||
//! let token = client.refresh_token(&http, token, None).unwrap();
|
//! let token = client.refresh_token(&http, token, None).unwrap();
|
||||||
//! # }
|
//! # }
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
//! # use inth_oauth2::provider::google::Installed;
|
//! # use inth_oauth2::provider::google::Installed;
|
||||||
//! # fn main() {
|
//! # fn main() {
|
||||||
//! # let client = Client::new(Installed, String::new(), String::new(), None);
|
//! # let client = Client::new(Installed, String::new(), String::new(), None);
|
||||||
//! # let http = reqwest::Client::new().unwrap();
|
//! # let http = reqwest::Client::new();
|
||||||
//! # let mut token = client.request_token(&http, "").unwrap();
|
//! # let mut token = client.request_token(&http, "").unwrap();
|
||||||
//! // Refresh token only if it has expired.
|
//! // Refresh token only if it has expired.
|
||||||
//! token = client.ensure_token(&http, token).unwrap();
|
//! token = client.ensure_token(&http, token).unwrap();
|
||||||
|
@ -116,9 +116,9 @@
|
||||||
//!
|
//!
|
||||||
//! # fn main() {
|
//! # fn main() {
|
||||||
//! # let oauth_client = Client::new(Installed, String::new(), String::new(), None);
|
//! # let oauth_client = Client::new(Installed, String::new(), String::new(), None);
|
||||||
//! # let http = reqwest::Client::new().unwrap();
|
//! # let http = reqwest::Client::new();
|
||||||
//! # let token = oauth_client.request_token(&http, "").unwrap();
|
//! # let token = oauth_client.request_token(&http, "").unwrap();
|
||||||
//! let request = http.get("https://example.com/resource").unwrap()
|
//! let request = http.get("https://example.com/resource")
|
||||||
//! .header(Into::<Authorization<_>>::into(&token))
|
//! .header(Into::<Authorization<_>>::into(&token))
|
||||||
//! .build();
|
//! .build();
|
||||||
//! # }
|
//! # }
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
//! # use inth_oauth2::Client;
|
//! # use inth_oauth2::Client;
|
||||||
//! # use inth_oauth2::provider::google::Installed;
|
//! # use inth_oauth2::provider::google::Installed;
|
||||||
//! # fn main() {
|
//! # fn main() {
|
||||||
//! # let http = reqwest::Client::new().unwrap();
|
//! # let http = reqwest::Client::new();
|
||||||
//! # let client = Client::new(Installed, String::new(), String::new(), None);
|
//! # let client = Client::new(Installed, String::new(), String::new(), None);
|
||||||
//! # let token = client.request_token(&http, "").unwrap();
|
//! # let token = client.request_token(&http, "").unwrap();
|
||||||
//! let json = serde_json::to_string(&token).unwrap();
|
//! let json = serde_json::to_string(&token).unwrap();
|
||||||
|
|
Loading…
Reference in New Issue