MCPcopy Create free account
hub / github.com/cronitorio/cronitor-cli / FormatJSON

Method FormatJSON

lib/api_client.go:172–178  ·  view source on GitHub ↗

FormatJSON pretty-prints the response body as JSON

()

Source from the content-addressed store, hash-verified

170
171// FormatJSON pretty-prints the response body as JSON
172func (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
181func (r *APIResponse) ParseError() string {

Callers 2

Calls

no outgoing calls

Tested by 2