[#168] session: Implement binary/JSON encoders/decoders on XHeader

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 16:58:08 +03:00 committed by Alex Vanin
parent 85d4713348
commit 7e3e9e1cba
4 changed files with 45 additions and 4 deletions

View file

@ -54,3 +54,15 @@ func TestSessionTokenJSON(t *testing.T) {
require.Equal(t, tok, tok2)
}
func TestXHeaderJSON(t *testing.T) {
x := generateXHeader("key", "value")
data, err := x.MarshalJSON()
require.NoError(t, err)
x2 := new(session.XHeader)
require.NoError(t, x2.UnmarshalJSON(data))
require.Equal(t, x, x2)
}