Media type precedence when fetching a GitHub release asset #123136
Unanswered
andrelegault
asked this question in
API and Webhooks
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Select Topic Area
Bug
Body
I'm trying to fetch a release asset from a private GitHub repository using the GitHub API (API reference: https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#get-a-release-asset). My understanding is the GitHub API must be used for this if used outside of a browser context.
That being said, I'm trying to fetch the binary content for an asset from the release of a private GitHub repository (not the JSON metadata for it). To do this, I'm following the documentation by including
application/octet-stream
to theAccept
header's values: https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#get-a-release-asset:~:text=To%20download%20the%20asset%27s%20binary%20content%2C%20set%20the%20Accept%20header%20of%20the%20request%20to%20application/octet%2DstreamPer the HTTP/1.1 RFC, specific media types should take precedence over more general ones: https://www.rfc-editor.org/rfc/rfc9110#section-12.5.1-14
However, I don't have full control over the header's values, and thus, it includes
*/*
. Following the RFC, this shouldn't be a problem since I've provided a specific media type, so it should be preferred over the more general one(
application/octet-stream
should take precedence over*/*
). This isn't the case, however, so I'm getting the json file instead of the actual binary content for the asset.Beta Was this translation helpful? Give feedback.
All reactions