INNER CODE UNIT · JavaScript
buildGithubCommitsUrl
EdgeTypE/better-deepseek · src/background/index.js:232
function buildGithubCommitsUrl(owner, repo, branch, perPage, page) {
const url = new URL(`https://api.github.com/repos/${owner}/${repo}/commits`);
url.searchParams.set("sha", branch);
url.searchParams.set("per_page", String(perPage));
url.searchParams.set("page", String(page));
return url.toString();
}
function isGithubRateLimitResponse(resp, bodyText) {
const remaining = Number.parseInt(
String(resp.headers.get("x-ratelimit-remaining") || ""),
10,
);
return (
(resp.status === 403 || resp.status === 429) &&
(
remaining === 0 ||
String(bodyText || "").toLowerCase().includes("api rate limit exceeded")