[#323] client: Remove xheaders length check in a common helper
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
d6d6a41f5d
commit
0e4d07fb06
6 changed files with 4 additions and 20 deletions
|
@ -57,6 +57,10 @@ func writeXHeadersToMeta(xHeaders []string, h *v2session.RequestMetaHeader) {
|
|||
return
|
||||
}
|
||||
|
||||
if len(xHeaders)%2 != 0 {
|
||||
panic("slice of X-Headers with odd length")
|
||||
}
|
||||
|
||||
hs := make([]v2session.XHeader, len(xHeaders)/2)
|
||||
for i := 0; i < len(xHeaders); i += 2 {
|
||||
hs[i].SetKey(xHeaders[i])
|
||||
|
|
|
@ -85,10 +85,6 @@ func (x *PrmObjectDelete) UseKey(key ecdsa.PrivateKey) {
|
|||
//
|
||||
// Slice must not be mutated until the operation completes.
|
||||
func (x *PrmObjectDelete) WithXHeaders(hs ...string) {
|
||||
if len(hs)%2 != 0 {
|
||||
panic("slice of X-Headers with odd length")
|
||||
}
|
||||
|
||||
writeXHeadersToMeta(hs, &x.meta)
|
||||
}
|
||||
|
||||
|
|
|
@ -36,10 +36,6 @@ type prmObjectRead struct {
|
|||
//
|
||||
// Slice must not be mutated until the operation completes.
|
||||
func (x *prmObjectRead) WithXHeaders(hs ...string) {
|
||||
if len(hs)%2 != 0 {
|
||||
panic("slice of X-Headers with odd length")
|
||||
}
|
||||
|
||||
writeXHeadersToMeta(hs, &x.meta)
|
||||
}
|
||||
|
||||
|
|
|
@ -116,10 +116,6 @@ func (x *PrmObjectHash) UseSalt(salt []byte) {
|
|||
//
|
||||
// Slice must not be mutated until the operation completes.
|
||||
func (x *PrmObjectHash) WithXHeaders(hs ...string) {
|
||||
if len(hs)%2 != 0 {
|
||||
panic("slice of X-Headers with odd length")
|
||||
}
|
||||
|
||||
writeXHeadersToMeta(hs, &x.meta)
|
||||
}
|
||||
|
||||
|
|
|
@ -102,10 +102,6 @@ func (x *PrmObjectPutInit) MarkLocal() {
|
|||
//
|
||||
// Slice must not be mutated until the operation completes.
|
||||
func (x *PrmObjectPutInit) WithXHeaders(hs ...string) {
|
||||
if len(hs)%2 != 0 {
|
||||
panic("slice of X-Headers with odd length")
|
||||
}
|
||||
|
||||
writeXHeadersToMeta(hs, &x.meta)
|
||||
}
|
||||
|
||||
|
|
|
@ -67,10 +67,6 @@ func (x *PrmObjectSearch) WithBearerToken(t bearer.Token) {
|
|||
//
|
||||
// Slice must not be mutated until the operation completes.
|
||||
func (x *PrmObjectSearch) WithXHeaders(hs ...string) {
|
||||
if len(hs)%2 != 0 {
|
||||
panic("slice of X-Headers with odd length")
|
||||
}
|
||||
|
||||
writeXHeadersToMeta(hs, &x.meta)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue