func formatResponseBody(res *http.Response, httpreq *httplib.BeegoHttpRequest, pretty bool) string { body, err := httpreq.Bytes() if err != nil { log.Fatalln("can't get the url", err) } fmt.Println("") if pretty && strings.Contains(res.Header.Get("Content-Type"), contentJsonRegex) { var output bytes.Buffer err := json.Indent(&output, body, "", " ") if err != nil { log.Fatal("Response Json Indent: ", err) } return output.String() } return string(body) }