fmt: repo-wide baseline (WI-2, issue #2)

This commit is contained in:
Jan-Peter von Hunnius 2026-10-03 11:53:59 +02:00
parent 899fde8fc3
commit 337e9bcf2c
19 changed files with 847 additions and 335 deletions

View file

@ -1,6 +1,6 @@
use axum::{
extract::Request,
http::{header, StatusCode},
http::{StatusCode, header},
middleware::Next,
response::Response,
};
@ -13,19 +13,14 @@ pub struct AuthUser {
pub role: String,
}
pub async fn auth_middleware(
mut request: Request,
next: Next,
) -> Result<Response, StatusCode> {
pub async fn auth_middleware(mut request: Request, next: Next) -> Result<Response, StatusCode> {
let auth_header = request
.headers()
.get(header::AUTHORIZATION)
.and_then(|v| v.to_str().ok())
.unwrap_or("");
let token = auth_header
.strip_prefix("Bearer ")
.unwrap_or(auth_header);
let token = auth_header.strip_prefix("Bearer ").unwrap_or(auth_header);
if token.is_empty() {
return Err(StatusCode::UNAUTHORIZED);