cli / cli/go-gh

Treat application/octocat-stream as an inspectable MIME type

Open
#210 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
438
Forks
94
Avg merge
5d 13h
Merged PRs (30d)
6

Description

Relates to: https://github.com/github/rest-api-description/issues/5178

When using the GitHub CLI with --verbose flag on endpoints that return non-standard content types (like application/octocat-stream from /octocat), the response body is not displayed even though the request succeeds.

```
$ gh api --verbose /octocat
* Request at 2026-01-27 15:15:09.70376 -0600 CST m=+0.070954459
* Request to https://api.github.com/octocat
> GET /octocat HTTP/1.1
> Host: api.github.com
...
< HTTP/2.0 200 OK
< Content-Type: application/octocat-stream
...

# No response body shown! 😿
```

Meanwhile, gh api /octocat (without --verbose) works correctly and displays the octocat ASCII art. The same applies to other tools like `curl` and `wget`.

## Root Cause

The [inspectableMIMEType](https://github.com/cli/go-gh/blob/a0a6e8947ae2ceedb496654757886ef41ef5ac72/pkg/api/http_client.go#L122-L125) determines which response bodies get logged. This function is used in the httpretty logger's [body filter](https://github.com/cli/go-gh/blob/a0a6e8947ae2ceedb496654757886ef41ef5ac72/pkg/api/http_client.go#L105-L107). Since `application/octocat-stream` doesn't match any of these patterns, the body gets filtered out.

## Proposed fix

Add `application/octocat-stream` to the list of inspectable MIME types

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.