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