[#198] sdk/client: Use XHeader type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
5452554b58
commit
fe336fd5ba
1 changed files with 4 additions and 14 deletions
|
@ -21,13 +21,9 @@ type (
|
||||||
apply(*clientOptions)
|
apply(*clientOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
xHeader struct {
|
|
||||||
v2session.XHeader
|
|
||||||
}
|
|
||||||
|
|
||||||
callOptions struct {
|
callOptions struct {
|
||||||
version *pkg.Version
|
version *pkg.Version
|
||||||
xHeaders []xHeader
|
xHeaders []*pkg.XHeader
|
||||||
ttl uint32
|
ttl uint32
|
||||||
epoch uint64
|
epoch uint64
|
||||||
session *token.SessionToken
|
session *token.SessionToken
|
||||||
|
@ -81,15 +77,9 @@ func newFuncCallOption(f func(option *callOptions)) *funcCallOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithXHeader(key, value string) CallOption {
|
func WithXHeader(x *pkg.XHeader) CallOption {
|
||||||
return newFuncCallOption(func(option *callOptions) {
|
return newFuncCallOption(func(option *callOptions) {
|
||||||
xhdr := new(v2session.XHeader)
|
option.xHeaders = append(option.xHeaders, x)
|
||||||
xhdr.SetKey(key)
|
|
||||||
xhdr.SetValue(value)
|
|
||||||
|
|
||||||
option.xHeaders = append(option.xHeaders, xHeader{
|
|
||||||
XHeader: *xhdr,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +115,7 @@ func v2MetaHeaderFromOpts(options callOptions) *v2session.RequestMetaHeader {
|
||||||
|
|
||||||
xhdrs := make([]*v2session.XHeader, len(options.xHeaders))
|
xhdrs := make([]*v2session.XHeader, len(options.xHeaders))
|
||||||
for i := range options.xHeaders {
|
for i := range options.xHeaders {
|
||||||
xhdrs[i] = &options.xHeaders[i].XHeader
|
xhdrs[i] = options.xHeaders[i].ToV2()
|
||||||
}
|
}
|
||||||
|
|
||||||
meta.SetXHeaders(xhdrs)
|
meta.SetXHeaders(xhdrs)
|
||||||
|
|
Loading…
Reference in a new issue