fix: do not modify userInfo when marshaling

This commit is contained in:
David Sharnoff 2023-03-27 13:40:10 -07:00 committed by Tim Möhlmann
parent be3cc13c27
commit e1d50faf9b
6 changed files with 23 additions and 11 deletions

View file

@ -6,6 +6,7 @@ import (
"encoding/json"
"io"
"os"
"reflect"
"strings"
"testing"
@ -38,10 +39,12 @@ func Test_assert_regression(t *testing.T) {
assert.JSONEq(t, want, first)
target := reflect.New(reflect.TypeOf(obj).Elem()).Interface()
require.NoError(t,
json.Unmarshal([]byte(first), obj),
json.Unmarshal([]byte(first), target),
)
second, err := json.Marshal(obj)
second, err := json.Marshal(target)
require.NoError(t, err)
assert.JSONEq(t, want, string(second))