For my project, I'm utilizing the GitHub API to access the raw README.md file using /repos/{owner}/{repo}/readme
. I've successfully executed the call using Thunderclient in VSCode and retrieved the raw file.
https://i.sstatic.net/FtkfW.png
However, when attempting the same call from within my React application, I receive a JSON object structured like this:
{
"name": "README.md",
"path": "README.md",
"sha": "...",
"size": 9,
"url": "https://api.github.com/repos/anubhavadarsh/Litaci/contents/README.md?ref=master",
"html_url": "https://github.com/anubhavadarsh/Litaci/blob/master/README.md",
"git_url": "https://api.github.com/repos/anubhavadarsh/Litaci/git/blobs/592c92302634be24522f96f3ed6649f389f1aa0d",
"download_url": "https://raw.githubusercontent.com/anubhavadarsh/Litaci/master/README.md",
"type": "file",
"content": "IyBMaXRhY2kK\n",
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/anubhavadarsh/Litaci/contents/README.md?ref=master",
"git": "https://api.github.com/repos/anubhavadarsh/Litaci/git/blobs/592c92302634be24522f96f3ed6649f389f1aa0d",
"html": "https://github.com/anubhavadarsh/Litaci/blob/master/README.md"
}
}
Just to note, I tested with a public repository not owned by me and successfully obtained the raw readme. However, my own repository continues to return the JSON object.