Skip to content

Commit

Permalink
Fix authentication middleware to return errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GPeaky committed Dec 11, 2023
1 parent 8c3366d commit c8d358d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/middlewares/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ impl<S> Middleware<S> for Admin {
}
}

// TODO: Fix this fucking shit and return errors
impl<S, Err> Service<web::WebRequest<Err>> for AdminMiddleware<S>
where
S: Service<web::WebRequest<Err>, Response = web::WebResponse, Error = web::Error>,
Expand Down
6 changes: 2 additions & 4 deletions src/middlewares/authenticated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub struct AuthenticationMiddleware<S> {
service: S,
}

// TODO: Fix this fucking shit and return errors
impl<S, Err> Service<web::WebRequest<Err>> for AuthenticationMiddleware<S>
where
S: Service<web::WebRequest<Err>, Response = web::WebResponse, Error = web::Error>,
Expand Down Expand Up @@ -74,9 +75,6 @@ where
ctx.call(&self.service, req).await
};

Box::pin(async move {
let res = fut.await?;
Ok(res)
})
Box::pin(fut)
}
}

0 comments on commit c8d358d

Please sign in to comment.