forked from TrueCloudLab/frostfs-api-go
[#168] session: Implement binary/JSON encoders/decoders on XHeader
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
85d4713348
commit
7e3e9e1cba
4 changed files with 45 additions and 4 deletions
|
@ -46,16 +46,14 @@ func TestCreateResponseBody_StableMarshal(t *testing.T) {
|
|||
|
||||
func TestXHeader_StableMarshal(t *testing.T) {
|
||||
xheaderFrom := generateXHeader("X-Header-Key", "X-Header-Value")
|
||||
transport := new(grpc.XHeader)
|
||||
|
||||
t.Run("non empty", func(t *testing.T) {
|
||||
wire, err := xheaderFrom.StableMarshal(nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = goproto.Unmarshal(wire, transport)
|
||||
require.NoError(t, err)
|
||||
xheaderTo := new(session.XHeader)
|
||||
require.NoError(t, xheaderTo.Unmarshal(wire))
|
||||
|
||||
xheaderTo := session.XHeaderFromGRPCMessage(transport)
|
||||
require.Equal(t, xheaderFrom, xheaderTo)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue