From 1ebaae5a6e47763477546177d693a0b2bb030f34 Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Wed, 10 Nov 2021 13:03:00 +0300 Subject: [PATCH] fix(enc.b64): add comma --- enc_b64.go | 1 + enc_comma_test.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/enc_b64.go b/enc_b64.go index 662734b..a036cf6 100644 --- a/enc_b64.go +++ b/enc_b64.go @@ -10,6 +10,7 @@ func (e *Encoder) Base64(data []byte) { e.Null() return } + e.comma() e.byte('"') encodedLen := base64.StdEncoding.EncodedLen(len(data)) start := len(e.buf) diff --git a/enc_comma_test.go b/enc_comma_test.go index 82aae39..9fec37e 100644 --- a/enc_comma_test.go +++ b/enc_comma_test.go @@ -36,11 +36,12 @@ func TestEncoder_comma(t *testing.T) { e.True() e.False() e.Null() + e.Base64(Raw{1}) e.Bool(true) e.ArrEnd() e.ObjEnd() - require.Equal(t, `{"a":1,"b":2,"c":[1,2,3,4.5,23,true,false,null,true]}`, e.String()) + require.Equal(t, `{"a":1,"b":2,"c":[1,2,3,4.5,23,true,false,null,"AQ==",true]}`, e.String()) }) t.Run("NoPanic", func(t *testing.T) { var e Encoder