Add timeouts to HTTP requests (#3908)

This commit is contained in:
iequidoo
2023-01-11 11:55:42 -03:00
committed by iequidoo
parent 6642083f52
commit 6d9d31cad1
6 changed files with 25 additions and 4 deletions

View File

@@ -158,7 +158,7 @@ pub async fn get_oauth2_access_token(
}
// ... and POST
let client = reqwest::Client::new();
let client = crate::http::get_client()?;
let response: Response = match client.post(post_url).form(&post_param).send().await {
Ok(resp) => match resp.json().await {
@@ -284,7 +284,14 @@ impl Oauth2 {
// "verified_email": true,
// "picture": "https://lh4.googleusercontent.com/-Gj5jh_9R0BY/AAAAAAAAAAI/AAAAAAAAAAA/IAjtjfjtjNA/photo.jpg"
// }
let response = match reqwest::get(userinfo_url).await {
let client = match crate::http::get_client() {
Ok(cl) => cl,
Err(err) => {
warn!(context, "failed to get HTTP client: {}", err);
return None;
}
};
let response = match client.get(userinfo_url).send().await {
Ok(response) => response,
Err(err) => {
warn!(context, "failed to get userinfo: {}", err);