rename Marshal to JSONMarshal

This commit is contained in:
Sun XingBo 2021-07-22 13:07:17 +08:00 committed by GitHub
parent 4a85237faf
commit efd710a652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -340,7 +340,7 @@ func (b *BeegoHTTPRequest) YAMLBody(obj interface{}) (*BeegoHTTPRequest, error)
// JSONBody adds the request raw body encoded in JSON. // JSONBody adds the request raw body encoded in JSON.
func (b *BeegoHTTPRequest) JSONBody(obj interface{}) (*BeegoHTTPRequest, error) { func (b *BeegoHTTPRequest) JSONBody(obj interface{}) (*BeegoHTTPRequest, error) {
if b.req.Body == nil && obj != nil { if b.req.Body == nil && obj != nil {
byts, err := b.Marshal(obj) byts, err := b.JSONMarshal(obj)
if err != nil { if err != nil {
return b, berror.Wrap(err, InvalidJSONBody, "obj could not be converted to JSON body") return b, berror.Wrap(err, InvalidJSONBody, "obj could not be converted to JSON body")
} }
@ -351,7 +351,7 @@ func (b *BeegoHTTPRequest) JSONBody(obj interface{}) (*BeegoHTTPRequest, error)
return b, nil return b, nil
} }
func (b *BeegoHTTPRequest) Marshal(obj interface{}) ([]byte, error) { func (b *BeegoHTTPRequest) JSONMarshal(obj interface{}) ([]byte, error) {
bf := bytes.NewBuffer([]byte{}) bf := bytes.NewBuffer([]byte{})
jsonEncoder := json.NewEncoder(bf) jsonEncoder := json.NewEncoder(bf)
jsonEncoder.SetEscapeHTML(b.setting.EscapeHTML) jsonEncoder.SetEscapeHTML(b.setting.EscapeHTML)