[#218] pkg/client: Add raw flag for object.Head

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-02 14:32:18 +03:00
parent 582cdd4ba3
commit 664ebfd8a7

View file

@ -40,6 +40,8 @@ type GetObjectParams struct {
type ObjectHeaderParams struct {
addr *object.Address
raw bool
short bool
}
@ -494,6 +496,14 @@ func (p *ObjectHeaderParams) WithMainFields() *ObjectHeaderParams {
return p
}
func (p *ObjectHeaderParams) WithRawFlag(v bool) *ObjectHeaderParams {
if p != nil {
p.raw = v
}
return p
}
func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) {
// check remote node version
switch c.remoteNode.Version.Major() {
@ -540,6 +550,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o
// fill body fields
body.SetAddress(p.addr.ToV2())
body.SetMainOnly(p.short)
body.SetRaw(p.raw)
// sign the request
if err := signature.SignServiceMessage(c.key, req); err != nil {