Skip to content

Commit

Permalink
Add debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught committed Nov 29, 2022
1 parent b16e634 commit 2e5ac1e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/cli/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ func apiCmdRun(cli *cli, inputs *apiCmdInputs) func(cmd *cobra.Command, args []s
request.Header.Set("Content-Type", "application/json")
request.Header.Set("User-Agent", fmt.Sprintf("%s/%s", userAgent, strings.TrimPrefix(buildinfo.Version, "v")))

if cli.debug {
cli.renderer.Infof("[%s]: %s", request.Method, request.URL.String())
}

response, err = http.DefaultClient.Do(request)
return err
}); err != nil {
Expand All @@ -142,6 +146,9 @@ func apiCmdRun(cli *cli, inputs *apiCmdInputs) func(cmd *cobra.Command, args []s
}

if len(rawBodyJSON) == 0 {
if cli.debug {
cli.renderer.Infof("Response body is empty.")
}
return nil
}

Expand Down

0 comments on commit 2e5ac1e

Please sign in to comment.