Skip printing headers when --silent in api

This commit is contained in:
AliabbasMerchant 2020-06-29 07:13:06 +05:30
parent 5e56e31384
commit aa43c55f60
2 changed files with 4 additions and 3 deletions

View file

@ -218,7 +218,7 @@ func apiRun(opts *ApiOptions) error {
}
func processResponse(resp *http.Response, opts *ApiOptions) (endCursor string, err error) {
if opts.ShowResponseHeaders {
if opts.ShowResponseHeaders && !opts.Silent {
fmt.Fprintln(opts.IO.Out, resp.Proto, resp.Status)
printHeaders(opts.IO.Out, resp.Header, opts.IO.ColorEnabled())
fmt.Fprint(opts.IO.Out, "\r\n")

View file

@ -467,8 +467,9 @@ func Test_apiRun_silent(t *testing.T) {
}
return &http.Client{Transport: tr}, nil
},
RequestPath: "issues",
Silent: true,
RequestPath: "issues",
ShowResponseHeaders: true,
Silent: true,
}
err := apiRun(&options)