fix: restore github api querystring (#3964)

This commit is contained in:
hoilc
2020-02-15 19:12:43 +08:00
committed by GitHub
parent c91095f469
commit 63aea3bc3c

View File

@@ -1,5 +1,6 @@
const got = require('@/utils/got');
const config = require('@/config').value;
const queryString = require('query-string');
module.exports = async (ctx) => {
const user = ctx.params.user;
@@ -14,6 +15,10 @@ module.exports = async (ctx) => {
headers.Authorization = `token ${config.github.access_token}`;
}
const res = await got.get(`https://api.github.com/repos/${user}/${repo}/commits`, {
searchParams: queryString.stringify({
sha: branch,
path: filepath,
}),
headers,
});
const list = res.data;