grokify/mogo

View on GitHub
net/http/httpsimple/simplerequest.go

Summary

Maintainability
A
1 hr
Test Coverage

Method Request.BodyBytes has 7 return statements (exceeds 4 allowed).
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
Severity: Major
Found in net/http/httpsimple/simplerequest.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    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
    Severity: Major
    Found in net/http/httpsimple/simplerequest.go - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status