mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
cmn: fix HexBytes.MarshalJSON
This commit is contained in:
parent
1460540acd
commit
2bb538b150
@ -26,7 +26,7 @@ func (bz HexBytes) MarshalJSON() ([]byte, error) {
|
||||
jbz := make([]byte, len(s)+2)
|
||||
jbz[0] = '"'
|
||||
copy(jbz[1:], []byte(s))
|
||||
jbz[1] = '"'
|
||||
jbz[len(jbz)-1] = '"'
|
||||
return jbz, nil
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,8 @@ func TestJSONMarshal(t *testing.T) {
|
||||
expected string
|
||||
}{
|
||||
{[]byte(``), `{"B1":"","B2":""}`},
|
||||
{[]byte(``), `{"B1":"","B2":""}`},
|
||||
{[]byte(``), `{"B1":"","B2":""}`},
|
||||
{[]byte(`a`), `{"B1":"YQ==","B2":"61"}`},
|
||||
{[]byte(`abc`), `{"B1":"YWJj","B2":"616263"}`},
|
||||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
|
Loading…
x
Reference in New Issue
Block a user