Commit 47a79141 authored by vaikas-google's avatar vaikas-google

Merge pull request #106 from bmelville/104

Pretty print JSON responses from service.
parents ccdd32b3 82e7d088
......@@ -169,7 +169,13 @@ func main() {
func callService(path, method, action string, reader io.ReadCloser) {
u := fmt.Sprintf("%s/%s", *service, path)
fmt.Println(callHttp(u, method, action, reader))
resp := callHttp(u, method, action, reader)
var prettyJSON bytes.Buffer
if err := json.Indent(&prettyJSON, []byte(resp), "", " "); err != nil {
log.Fatalf("Failed to parse JSON response from service: %s", resp)
}
fmt.Println(prettyJSON.String())
}
func callHttp(path, method, action string, reader io.ReadCloser) string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment