Skip to content

Commit aa43c55

Browse files
Skip printing headers when --silent in api
1 parent 5e56e31 commit aa43c55

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/cmd/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func apiRun(opts *ApiOptions) error {
218218
}
219219

220220
func processResponse(resp *http.Response, opts *ApiOptions) (endCursor string, err error) {
221-
if opts.ShowResponseHeaders {
221+
if opts.ShowResponseHeaders && !opts.Silent {
222222
fmt.Fprintln(opts.IO.Out, resp.Proto, resp.Status)
223223
printHeaders(opts.IO.Out, resp.Header, opts.IO.ColorEnabled())
224224
fmt.Fprint(opts.IO.Out, "\r\n")

pkg/cmd/api/api_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,9 @@ func Test_apiRun_silent(t *testing.T) {
467467
}
468468
return &http.Client{Transport: tr}, nil
469469
},
470-
RequestPath: "issues",
471-
Silent: true,
470+
RequestPath: "issues",
471+
ShowResponseHeaders: true,
472+
Silent: true,
472473
}
473474

474475
err := apiRun(&options)

0 commit comments

Comments
 (0)