mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-09-02 18:28:12 +00:00
test: some error rework
This commit is contained in:
@@ -11,8 +11,13 @@ pub enum Error {
|
||||
Common(CommonError),
|
||||
|
||||
/// Authorization Header Malformed
|
||||
#[error("Authorization header malformed, unexpected scope: {0}")]
|
||||
AuthorizationHeaderMalformed(String),
|
||||
#[error(
|
||||
"Authorization header malformed, unexpected scope: '{unexpected}', expected: '{expected}'"
|
||||
)]
|
||||
AuthorizationHeaderMalformed {
|
||||
unexpected: String,
|
||||
expected: String,
|
||||
},
|
||||
|
||||
// Category: bad request
|
||||
/// The request contained an invalid UTF-8 sequence in its path or in other parameters
|
||||
|
||||
@@ -400,7 +400,10 @@ pub fn verify_v4(
|
||||
) -> Result<Key, Error> {
|
||||
let scope_expected = compute_scope(&auth.date, &garage.config.s3_api.s3_region, service);
|
||||
if auth.scope != scope_expected {
|
||||
return Err(Error::AuthorizationHeaderMalformed(auth.scope.to_string()));
|
||||
return Err(Error::AuthorizationHeaderMalformed {
|
||||
unexpected: auth.scope.to_string(),
|
||||
expected: scope_expected,
|
||||
});
|
||||
}
|
||||
|
||||
let key = garage
|
||||
|
||||
Reference in New Issue
Block a user