Skip printing headers when --silent in api
This commit is contained in:
parent
5e56e31384
commit
aa43c55f60
2 changed files with 4 additions and 3 deletions
|
|
@ -218,7 +218,7 @@ func apiRun(opts *ApiOptions) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func processResponse(resp *http.Response, opts *ApiOptions) (endCursor string, err 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)
|
fmt.Fprintln(opts.IO.Out, resp.Proto, resp.Status)
|
||||||
printHeaders(opts.IO.Out, resp.Header, opts.IO.ColorEnabled())
|
printHeaders(opts.IO.Out, resp.Header, opts.IO.ColorEnabled())
|
||||||
fmt.Fprint(opts.IO.Out, "\r\n")
|
fmt.Fprint(opts.IO.Out, "\r\n")
|
||||||
|
|
|
||||||
|
|
@ -467,8 +467,9 @@ func Test_apiRun_silent(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Client{Transport: tr}, nil
|
return &http.Client{Transport: tr}, nil
|
||||||
},
|
},
|
||||||
RequestPath: "issues",
|
RequestPath: "issues",
|
||||||
Silent: true,
|
ShowResponseHeaders: true,
|
||||||
|
Silent: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := apiRun(&options)
|
err := apiRun(&options)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue