diff --git a/methods/fns.go b/methods/fns.go index 4266fa6..d2f31a5 100644 --- a/methods/fns.go +++ b/methods/fns.go @@ -14,7 +14,9 @@ import ( // Formatresp formats the Response with Indents and Colors func formatresp(resp *http.Response) string { - c := color.New(color.FgCyan) + c := color.New(color.FgCyan, color.Bold) + magenta := color.New(color.FgHiMagenta) + yellow := color.New(color.FgHiYellow) body, err := ioutil.ReadAll(resp.Body) str := string(body) var obj map[string]interface{} @@ -23,9 +25,10 @@ func formatresp(resp *http.Response) string { f.Indent = 6 s, _ := f.Marshal(obj) for key, value := range resp.Header { - c.Print(key, " : ", value, "\n") + c.Print(key, " : ") + magenta.Print(value, "\n") } - retbody := fmt.Sprintf("\nStatus:\t\t%s\n\nStatusCode:\t%d\n\n%s\n", resp.Status, resp.StatusCode, string(s)) + retbody := yellow.Sprintf("\nStatus:\t\t%s\n\nStatusCode:\t%d\n", resp.Status, resp.StatusCode) + fmt.Sprintf("\n%s\n", string(s)) if err != nil { log.Println("Error on response.\n[ERRO] -", err) } diff --git a/methods/get.go b/methods/get.go index e1240d5..7194e29 100644 --- a/methods/get.go +++ b/methods/get.go @@ -31,6 +31,6 @@ func Getbasic(c *cli.Context) error { } defer resp.Body.Close() s := formatresp(resp) - fmt.Printf("\n%s", s) + fmt.Println(s) return nil } diff --git a/methods/post.go b/methods/post.go index 5238b18..e580e24 100644 --- a/methods/post.go +++ b/methods/post.go @@ -31,5 +31,5 @@ func Postbasic(c *cli.Context) { } defer resp.Body.Close() s := formatresp(resp) - fmt.Println("response Body:", s) + fmt.Println(s) } diff --git a/methods/put.go b/methods/put.go index d905a1f..040b72b 100644 --- a/methods/put.go +++ b/methods/put.go @@ -32,5 +32,5 @@ func Putbasic(c *cli.Context) { defer resp.Body.Close() s := formatresp(resp) - fmt.Println("\nresponse Body:\n", s) + fmt.Println(s) }