about summary refs log tree commit diff
path: root/src/indieauth
diff options
context:
space:
mode:
Diffstat (limited to 'src/indieauth')
-rw-r--r--src/indieauth/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/indieauth/mod.rs b/src/indieauth/mod.rs
index 322a0e2..b3db77f 100644
--- a/src/indieauth/mod.rs
+++ b/src/indieauth/mod.rs
@@ -131,7 +131,7 @@ async fn authorization_endpoint_get<A: AuthBackend, D: Storage + 'static>(
     Host(host): Host,
     Query(request): Query<AuthorizationRequest>,
     State(db): State<D>,
-    State(http): State<reqwest::Client>,
+    State(http): State<reqwest_middleware::ClientWithMiddleware>,
     State(auth): State<A>
 ) -> Response {
     let me: url::Url = format!("https://{host}/").parse().unwrap();
@@ -148,7 +148,10 @@ async fn authorization_endpoint_get<A: AuthBackend, D: Storage + 'static>(
         tracing::debug!("Sending request to {} to fetch metadata", request.client_id);
         let metadata_request = http.get(request.client_id.clone())
             .header("Accept", "application/json, text/html");
-        match metadata_request.send().await.and_then(|res| res.error_for_status()) {
+        match metadata_request.send().await
+            .and_then(|res| res.error_for_status()
+                .map_err(reqwest_middleware::Error::Reqwest))
+        {
             Ok(response) if response.headers().typed_get::<ContentType>().to_owned().map(mime::Mime::from).map(|m| m.type_() == "text" && m.subtype() == "html").unwrap_or(false) => {
                 let url = response.url().clone();
                 let text = response.text().await.unwrap();
@@ -847,7 +850,7 @@ pub fn router<St, A, S>() -> axum::Router<St>
 where
     S: Storage + FromRef<St> + 'static,
     A: AuthBackend + FromRef<St>,
-    reqwest::Client: FromRef<St>,
+    reqwest_middleware::ClientWithMiddleware: FromRef<St>,
     St: Clone + Send + Sync + 'static
 {
     use axum::routing::{Router, get, post};