Skip to content

[Schema Inaccuracy] Improper response type for /octocat #5178

@ricardoboss

Description

@ricardoboss

Schema Inaccuracy

The endpoint https://api.github.com/octocat declares only one response: an application/octocat-stream (not octet-stream).

As fun as it is, it prevents using this endpoint from, say, the GitHub CLI:

gh api --verbose /octocat:

* Request at 2025-08-07 21:59:18.1013867 +0200 CEST m=+0.051982601
* Request to https://api.github.com/octocat
> GET /octocat HTTP/1.1
> Host: api.github.com
> Accept: */*
> Authorization: token ████████████████████
> Content-Type: application/json; charset=utf-8
> Time-Zone: Europe/Berlin
> User-Agent: GitHub CLI 2.43.1

< HTTP/2.0 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
< Content-Length: 873
< Content-Security-Policy: default-src 'none'
< Content-Type: application/octocat-stream
< Date: Thu, 07 Aug 2025 19:59:20 GMT
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: github.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Api-Version-Selected: 2022-11-28
< X-Github-Request-Id: F84E:2CFBD5:440694:3DAEC6:68950597
< X-Ratelimit-Limit: 5000
< X-Ratelimit-Remaining: 4972
< X-Ratelimit-Reset: 1754597128
< X-Ratelimit-Resource: core
< X-Ratelimit-Used: 28
< X-Xss-Protection: 0

* Request took 314.4962ms

...with no octocat in sight.

The request even fails when explicitly only accepting any other content type.

Expected

I would expect the endpoint to declare that it returns a text/plain body, both in the spec as well as in the actual response.
Also, it should allow requests with Accept: text/plain in the request headers.

Reproduction Steps

For the above output:

gh api --verbose /octocat

For the failure with a different Accept header:

gh api --verbose /octocat -H "Accept: application/octocat-stream"

or:

gh api --verbose /octocat -H "Accept: text/plain"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions