[#326] client: Sign message in object.GetRange'

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-08-29 13:13:21 +03:00 committed by fyrchik
parent cf7bee3087
commit ee92df3203

View file

@ -686,6 +686,16 @@ func (c *Client) ObjectRangeInit(ctx context.Context, prm PrmObjectRange) (*Obje
req.SetBody(&body) req.SetBody(&body)
c.prepareRequest(&req, &prm.meta) c.prepareRequest(&req, &prm.meta)
key := prm.key
if key == nil {
key = &c.prm.key
}
err := signature.SignServiceMessage(key, &req)
if err != nil {
return nil, fmt.Errorf("sign request: %w", err)
}
ctx, cancel := context.WithCancel(ctx) ctx, cancel := context.WithCancel(ctx)
stream, err := rpcapi.GetObjectRange(&c.c, &req, client.WithContext(ctx)) stream, err := rpcapi.GetObjectRange(&c.c, &req, client.WithContext(ctx))