clipped
This commit is contained in:
@@ -29,12 +29,12 @@ pub async fn get_current_user_handler(
|
|||||||
.headers()
|
.headers()
|
||||||
.get("Authorization")
|
.get("Authorization")
|
||||||
.and_then(|header_value| header_value.to_str().ok())
|
.and_then(|header_value| header_value.to_str().ok())
|
||||||
.and_then(|auth_str| {
|
.map(|auth_str| {
|
||||||
// Убираем префикс "Bearer " если он есть
|
// Убираем префикс "Bearer " если он есть
|
||||||
if auth_str.starts_with("Bearer ") {
|
if let Some(stripped) = auth_str.strip_prefix("Bearer ") {
|
||||||
Some(&auth_str[7..])
|
stripped
|
||||||
} else {
|
} else {
|
||||||
Some(auth_str)
|
auth_str
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user