FormatJSON pretty-prints the response body as JSON
()
| 170 | |
| 171 | // FormatJSON pretty-prints the response body as JSON |
| 172 | func (r *APIResponse) FormatJSON() string { |
| 173 | var buf bytes.Buffer |
| 174 | if err := json.Indent(&buf, r.Body, "", " "); err != nil { |
| 175 | return string(r.Body) |
| 176 | } |
| 177 | return buf.String() |
| 178 | } |
| 179 | |
| 180 | // ParseError attempts to extract an error message from the response |
| 181 | func (r *APIResponse) ParseError() string { |
no outgoing calls