feat: adds Location, x-amz-bucket-arn response headers in CreateBucket

Closes #1873
This commit is contained in:
niksis02
2026-02-20 13:02:51 +04:00
parent a81f9e5152
commit 7fb3dedecc
5 changed files with 45 additions and 25 deletions
+13 -1
View File
@@ -632,9 +632,21 @@ func (c S3ApiController) CreateBucket(ctx *fiber.Ctx) (*Response, error) {
Tags: body.TagSet,
},
}, updAcl)
if err != nil {
return &Response{
MetaOpts: &MetaOptions{
BucketOwner: bucketOwner.Access,
},
}, err
}
return &Response{
MetaOpts: &MetaOptions{
BucketOwner: bucketOwner.Access,
},
}, err
Headers: map[string]*string{
"Location": utils.GetStringPtr("/" + bucket),
"x-amz-bucket-arn": utils.GetStringPtr(auth.ResourceArnPrefix + bucket),
},
}, nil
}
+5
View File
@@ -888,12 +888,17 @@ func TestS3ApiController_CreateBucket(t *testing.T) {
locals: map[utils.ContextKey]any{
utils.ContextKeyAccount: adminAcc,
},
bucket: "my-bucket",
},
output: testOutput{
response: &Response{
MetaOpts: &MetaOptions{
BucketOwner: adminAcc.Access,
},
Headers: map[string]*string{
"Location": utils.GetStringPtr("/my-bucket"),
"x-amz-bucket-arn": utils.GetStringPtr("arn:aws:s3:::my-bucket"),
},
},
},
},