From 582cdd4ba38c8288112be0d030232f406fdee53e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 2 Dec 2020 14:30:50 +0300 Subject: [PATCH] [#218] pkg/client: Add raw flag for object.Get Signed-off-by: Alex Vanin --- pkg/client/object.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/client/object.go b/pkg/client/object.go index 21d0d50c..ea2609da 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -32,6 +32,8 @@ type DeleteObjectParams struct { type GetObjectParams struct { addr *object.Address + raw bool + w io.Writer } @@ -346,6 +348,14 @@ func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams { return p } +func (p *GetObjectParams) WithRawFlag(v bool) *GetObjectParams { + if p != nil { + p.raw = v + } + + return p +} + func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) { // check remote node version switch c.remoteNode.Version.Major() { @@ -391,6 +401,7 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca // fill body fields body.SetAddress(p.addr.ToV2()) + body.SetRaw(p.raw) // sign the request if err := signature.SignServiceMessage(c.key, req); err != nil {