Skip to content

Commit

Permalink
Merge pull request #799 from isucon/feature/return-unauthorized
Browse files Browse the repository at this point in the history
feat(rust): アクセストークンが誤っている時にUnauthorizedを返す
  • Loading branch information
tohutohu authored Dec 7, 2024
2 parents 196ab48 + f4c17fd commit 1bfea08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions webapp/rust/src/middlewares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub async fn app_auth_middleware(
.fetch_optional(&pool)
.await?
else {
return Err(Error::BadRequest("invalid access token"));
return Err(Error::Unauthorized("invalid access token"));
};

req.extensions_mut().insert(user);
Expand All @@ -44,7 +44,7 @@ pub async fn owner_auth_middleware(
.fetch_optional(&pool)
.await?
else {
return Err(Error::BadRequest("invalid access token"));
return Err(Error::Unauthorized("invalid access token"));
};

req.extensions_mut().insert(owner);
Expand All @@ -67,7 +67,7 @@ pub async fn chair_auth_middleware(
.fetch_optional(&pool)
.await?
else {
return Err(Error::BadRequest("invalid access token"));
return Err(Error::Unauthorized("invalid access token"));
};

req.extensions_mut().insert(chair);
Expand Down

0 comments on commit 1bfea08

Please sign in to comment.