net/http/httpsimple/simplerequest.go
Method Request.BodyBytes
has 7 return statements (exceeds 4 allowed). Open
Open
func (req *Request) BodyBytes() ([]byte, error) {
if req.Body == nil {
return []byte{}, nil
} else if reqBodyBytes, ok := req.Body.([]byte); ok {
return reqBodyBytes, nil
Avoid deeply nested control flow statements. Open
Open
} else if req.BodyType == BodyTypeXML {
return xmlutil.MarshalIndent(req.Body, "", "", req.AddXMLDocType)
} else if req.BodyType == BodyTypeForm {
if v, ok := req.Body.(url.Values); ok {
return []byte(v.Encode()), nil