forked from TrueCloudLab/frostfs-http-gw
[#125] Set object ids in a separate function
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
2764fabf04
commit
39c29c6d6a
2 changed files with 10 additions and 6 deletions
|
@ -176,9 +176,8 @@ func (r request) receiveFile(clnt pool.Object, objectAddress *object.Address) {
|
|||
contentType = val
|
||||
}
|
||||
}
|
||||
r.Response.Header.Set(hdrObjectID, obj.ID().String())
|
||||
r.Response.Header.Set(hdrOwnerID, obj.OwnerID().String())
|
||||
r.Response.Header.Set(hdrContainerID, obj.ContainerID().String())
|
||||
|
||||
idsToResponse(&r.Response, obj)
|
||||
|
||||
if len(contentType) == 0 {
|
||||
if readDetector.err != nil {
|
||||
|
|
|
@ -63,9 +63,8 @@ func (r request) headObject(clnt pool.Object, objectAddress *object.Address) {
|
|||
contentType = val
|
||||
}
|
||||
}
|
||||
r.Response.Header.Set(hdrObjectID, obj.ID().String())
|
||||
r.Response.Header.Set(hdrOwnerID, obj.OwnerID().String())
|
||||
r.Response.Header.Set(hdrContainerID, obj.ContainerID().String())
|
||||
|
||||
idsToResponse(&r.Response, obj)
|
||||
|
||||
if len(contentType) == 0 {
|
||||
objRange := object.NewRange()
|
||||
|
@ -86,6 +85,12 @@ func (r request) headObject(clnt pool.Object, objectAddress *object.Address) {
|
|||
r.SetContentType(contentType)
|
||||
}
|
||||
|
||||
func idsToResponse(resp *fasthttp.Response, obj *object.Object) {
|
||||
resp.Header.Set(hdrObjectID, obj.ID().String())
|
||||
resp.Header.Set(hdrOwnerID, obj.OwnerID().String())
|
||||
resp.Header.Set(hdrContainerID, obj.ContainerID().String())
|
||||
}
|
||||
|
||||
// HeadByAddress handles head requests using simple cid/oid format.
|
||||
func (d *Downloader) HeadByAddress(c *fasthttp.RequestCtx) {
|
||||
d.byAddress(c, request.headObject)
|
||||
|
|
Loading…
Reference in a new issue