Improved bucket authorization response strings.
This commit is contained in:
parent
004bb5b4f1
commit
9c354f0a8f
@ -119,12 +119,16 @@ impl AdminApiServer {
|
|||||||
let bucket_website_config = bucket_state.website_config.get();
|
let bucket_website_config = bucket_state.website_config.get();
|
||||||
|
|
||||||
match bucket_website_config {
|
match bucket_website_config {
|
||||||
Some(_v) => Ok(Response::builder()
|
Some(_v) => {
|
||||||
.status(StatusCode::OK)
|
Ok(Response::builder()
|
||||||
.body(Body::from("Bucket authorized for website hosting"))?),
|
.status(StatusCode::OK)
|
||||||
None => Err(Error::bad_request(
|
.body(Body::from(format!(
|
||||||
"Bucket is not authorized for website hosting",
|
"Bucket '{domain}' is authorized for website hosting"
|
||||||
)),
|
)))?)
|
||||||
|
}
|
||||||
|
None => Err(Error::bad_request(format!(
|
||||||
|
"Bucket '{domain}' is not authorized for website hosting"
|
||||||
|
))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ async fn test_website() {
|
|||||||
res_body,
|
res_body,
|
||||||
json!({
|
json!({
|
||||||
"code": "InvalidRequest",
|
"code": "InvalidRequest",
|
||||||
"message": "Bad request: Bucket is not authorized for website hosting",
|
"message": "Bad request: Bucket 'my-website' is not authorized for website hosting",
|
||||||
"region": "garage-integ-test",
|
"region": "garage-integ-test",
|
||||||
"path": "/check",
|
"path": "/check",
|
||||||
})
|
})
|
||||||
@ -107,7 +107,7 @@ async fn test_website() {
|
|||||||
assert_eq!(admin_resp.status(), StatusCode::OK);
|
assert_eq!(admin_resp.status(), StatusCode::OK);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
to_bytes(admin_resp.body_mut()).await.unwrap().as_ref(),
|
to_bytes(admin_resp.body_mut()).await.unwrap().as_ref(),
|
||||||
b"Bucket authorized for website hosting"
|
format!("Bucket '{BCKT_NAME}' is authorized for website hosting").as_bytes()
|
||||||
);
|
);
|
||||||
|
|
||||||
ctx.garage
|
ctx.garage
|
||||||
@ -142,7 +142,7 @@ async fn test_website() {
|
|||||||
res_body,
|
res_body,
|
||||||
json!({
|
json!({
|
||||||
"code": "InvalidRequest",
|
"code": "InvalidRequest",
|
||||||
"message": "Bad request: Bucket is not authorized for website hosting",
|
"message": "Bad request: Bucket 'my-website' is not authorized for website hosting",
|
||||||
"region": "garage-integ-test",
|
"region": "garage-integ-test",
|
||||||
"path": "/check",
|
"path": "/check",
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user