Skip to content

Commit

Permalink
Clean up auth header checking
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Mar 5, 2024
1 parent fc19403 commit a0683d8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,8 @@ async fn get_tts(
) -> ResponseResult<Response<axum::body::Body>> {
let state = STATE.get().unwrap();
if let Some(auth_key) = state.auth_key.as_deref() {
if headers
.get("Authorization")
.map(HeaderValue::to_str)
.transpose()?
!= Some(auth_key)
{
let auth_header = headers.get("Authorization");
if auth_header.map(HeaderValue::to_str).transpose()? != Some(auth_key) {
return Err(Error::Unauthorized);
}
}
Expand Down

0 comments on commit a0683d8

Please sign in to comment.