[#220] Add cid to HeadBucket response

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2021-08-23 11:37:08 +03:00
parent 76fc241bc1
commit 84508a1706
2 changed files with 5 additions and 1 deletions

View file

@ -54,10 +54,12 @@ func (h *handler) HeadObjectHandler(w http.ResponseWriter, r *http.Request) {
func (h *handler) HeadBucketHandler(w http.ResponseWriter, r *http.Request) {
reqInfo := api.GetReqInfo(r.Context())
if _, err := h.obj.GetBucketInfo(r.Context(), reqInfo.BucketName); err != nil {
bktInfo, err := h.obj.GetBucketInfo(r.Context(), reqInfo.BucketName)
if err != nil {
h.logAndSendError(w, "could not fetch object info", reqInfo, err)
return
}
w.Header().Set(api.ContainerID, bktInfo.CID.String())
api.WriteResponse(w, http.StatusOK, nil, api.MimeNone)
}

View file

@ -39,4 +39,6 @@ const (
AmzGrantRead = "X-Amz-Grant-Read"
AmzGrantWrite = "X-Amz-Grant-Write"
AmzExpectedBucketOwner = "X-Amz-Expected-Bucket-Owner"
ContainerID = "X-Container-Id"
)