fix: github rate limiter with multiple PATs

This commit is contained in:
anuraghazra
2020-07-15 14:59:25 +05:30
parent 2efb399f33
commit 3d8dea90e2
6 changed files with 78 additions and 25 deletions
+9 -3
View File
@@ -33,13 +33,13 @@ function isValidHexColor(hexColor) {
).test(hexColor);
}
function request(data) {
function request(data, headers) {
return new Promise((resolve, reject) => {
axios({
url: "https://api.github.com/graphql",
method: "post",
headers: {
Authorization: `bearer ${process.env.GITHUB_TOKEN}`,
...headers,
},
data,
})
@@ -48,4 +48,10 @@ function request(data) {
});
}
module.exports = { renderError, kFormatter, encodeHTML, isValidHexColor, request };
module.exports = {
renderError,
kFormatter,
encodeHTML,
isValidHexColor,
request,
};