From 5ee4bf80ae40f4b6849d19617c3cd4cbfed95eb4 Mon Sep 17 00:00:00 2001 From: Artem Tataurov Date: Mon, 30 Jan 2023 19:44:28 +0300 Subject: [PATCH] [#18] Return container name in head-bucket response Signed-off-by: Artem Tataurov --- CHANGELOG.md | 1 + api/handler/head.go | 1 + api/headers.go | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f389a27f..8e86ac4c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This document outlines major changes between releases. ## [Unreleased] ### Added +- Return container name in `head-bucket` response (TrueCloudLab#18) - Billing metrics (TrueCloudLab#5) ### Changed diff --git a/api/handler/head.go b/api/handler/head.go index 2bfce705d..0bead4b99 100644 --- a/api/handler/head.go +++ b/api/handler/head.go @@ -123,6 +123,7 @@ func (h *handler) HeadBucketHandler(w http.ResponseWriter, r *http.Request) { } w.Header().Set(api.ContainerID, bktInfo.CID.EncodeToString()) + w.Header().Set(api.ContainerName, bktInfo.Name) w.Header().Set(api.AmzBucketRegion, bktInfo.LocationConstraint) api.WriteResponse(w, http.StatusOK, nil, api.MimeNone) } diff --git a/api/headers.go b/api/headers.go index 2e0b9a8a9..8f5307e93 100644 --- a/api/headers.go +++ b/api/headers.go @@ -62,7 +62,8 @@ const ( AmzServerSideEncryptionCustomerKey = "x-amz-server-side-encryption-customer-key" AmzServerSideEncryptionCustomerKeyMD5 = "x-amz-server-side-encryption-customer-key-MD5" - ContainerID = "X-Container-Id" + ContainerID = "X-Container-Id" + ContainerName = "X-Container-Name" AccessControlAllowOrigin = "Access-Control-Allow-Origin" AccessControlAllowMethods = "Access-Control-Allow-Methods"