I am using GitHub API to fetch file from repo:
const octokit = new Octokit({
auth: "*******************************",
});
const response = await octokit.request(
"GET /repos/owner/repo/contents/path",
{
owner: "owner",
repo: "repo",
path: "path",
}
);
but I am getting response in base64 format.
I need to add header Accept: application/vnd.github.VERSION.raw.
Is there a way to add headers in Octokit request?
You can register custom endpoint methods such as
octokit.rest.repos.get()using theoctokit.registerEndpoints(routes)methodview more here Register Custom endpoint | octokit/rest.js documentation