Merge pull request #224 from KirillovDenis/feature/220-add_cid_to_head_bucket_response

[#220] Add cid to HeadBucket response
This commit is contained in:
Alex Vanin 2021-08-24 18:10:13 +03:00 committed by GitHub
commit 68e4e1bbc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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"
)