diff --git a/pkg/services/object/util/prm.go b/pkg/services/object/util/prm.go index 995f5bcb..a34f3e97 100644 --- a/pkg/services/object/util/prm.go +++ b/pkg/services/object/util/prm.go @@ -3,6 +3,7 @@ package util import ( "crypto/ecdsa" + "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/token" "github.com/nspcc-dev/neofs-api-go/v2/session" @@ -109,11 +110,15 @@ func CommonPrmFromV2(req interface { }) *CommonPrm { meta := req.GetMetaHeader() + xHdrs := meta.GetXHeaders() + + const staticOptNum = 3 + prm := &CommonPrm{ local: meta.GetTTL() <= 1, // FIXME: use constant token: nil, bearer: nil, - callOpts: make([]client.CallOption, 0, 3), + callOpts: make([]client.CallOption, 0, staticOptNum+len(xHdrs)), } prm.callOpts = append(prm.callOpts, client.WithTTL(meta.GetTTL()-1)) @@ -128,5 +133,13 @@ func CommonPrmFromV2(req interface { prm.callOpts = append(prm.callOpts, client.WithBearer(prm.bearer)) } + for i := range xHdrs { + prm.callOpts = append(prm.callOpts, + client.WithXHeader( + pkg.NewXHeaderFromV2(xHdrs[i]), + ), + ) + } + return prm }