File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
routing/http/internal/drjson Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -5,22 +5,22 @@ import (
55 "encoding/json"
66)
77
8- func marshalJSON (val any ) (* bytes. Buffer , error ) {
8+ func marshalJSON (val any ) ([] byte , error ) {
99 buf := & bytes.Buffer {}
1010 enc := json .NewEncoder (buf )
1111 enc .SetEscapeHTML (false )
1212 err := enc .Encode (val )
13- return buf , err
13+ return buf . Bytes () , err
1414}
1515
1616// MarshalJSONBytes is needed to avoid changes
1717// on the original bytes due to HTML escapes.
1818func MarshalJSONBytes (val any ) ([]byte , error ) {
19- buf , err := marshalJSON (val )
19+ bytes , err := marshalJSON (val )
2020 if err != nil {
2121 return nil , err
2222 }
2323
2424 // remove last \n added by Encode
25- return buf . Bytes ()[: buf . Len ( )- 1 ], nil
25+ return bytes [: len ( bytes )- 1 ], nil
2626}
You can’t perform that action at this time.
0 commit comments