Basic auth in HTTP API

This commit is contained in:
Igor Katson 2024-11-20 17:20:44 +00:00
parent 09c9659b88
commit 3e8a39314b
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
4 changed files with 77 additions and 5 deletions

View file

@ -55,6 +55,10 @@ impl ApiError {
}
}
pub const fn unathorized() -> Self {
Self::new_from_text(StatusCode::UNAUTHORIZED, "unauthorized")
}
pub fn status(&self) -> StatusCode {
self.status.unwrap_or(StatusCode::INTERNAL_SERVER_ERROR)
}