fix: add loki-preview headers to repository query (#611)

Should enable merge settings to be shown during initRepo
This commit is contained in:
Rhys Arkins 2017-08-04 14:51:21 +02:00 committed by GitHub
parent f8ec742b3b
commit 6a7f57165f
2 changed files with 155 additions and 31 deletions

View file

@ -172,7 +172,11 @@ async function initRepo(repoName, token, endpoint, repoLogger) {
config.repoName = repoName;
const platformConfig = {};
try {
const res = await ghGotRetry(`repos/${repoName}`);
const res = await ghGotRetry(`repos/${repoName}`, {
headers: {
accept: 'application/vnd.github.loki-preview+json',
},
});
logger.trace({ repositoryDetails: res.body }, 'Repository details');
platformConfig.privateRepo = res.body.private === true;
platformConfig.isFork = res.body.fork === true;

View file

@ -53,7 +53,11 @@ exports[`api/github branchExists(branchName) should propagate unknown errors 1`]
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -78,7 +82,11 @@ exports[`api/github branchExists(branchName) should return false if a 404 is ret
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -103,7 +111,11 @@ exports[`api/github branchExists(branchName) should return false if the branch d
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -128,7 +140,11 @@ exports[`api/github branchExists(branchName) should return false if the branch d
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -153,7 +169,11 @@ exports[`api/github branchExists(branchName) should return true if the branch ex
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -178,7 +198,11 @@ exports[`api/github branchExists(branchName) should return true if the branch ex
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -203,7 +227,11 @@ exports[`api/github commitFilesToBranch(branchName, files, message, parentBranch
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -289,7 +317,11 @@ exports[`api/github commitFilesToBranch(branchName, files, message, parentBranch
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -424,7 +456,11 @@ exports[`api/github findFilePaths(fileName) should return empty array if none fo
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -449,7 +485,11 @@ exports[`api/github findFilePaths(fileName) should return the files matching the
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -482,7 +522,11 @@ exports[`api/github findPr(branchName, prTitle, state) should return a PR object
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -516,7 +560,11 @@ exports[`api/github findPr(branchName, prTitle, state) should return null if no
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -541,7 +589,11 @@ exports[`api/github findPr(branchName, prTitle, state) should set the isClosed a
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -600,7 +652,11 @@ exports[`api/github getBranchPr(branchName) should return null if no PR exists 1
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -625,7 +681,11 @@ exports[`api/github getBranchPr(branchName) should return the PR object 1`] = `
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -675,7 +735,11 @@ exports[`api/github getFile(filePatch, branchName) should return the encoded fil
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -700,7 +764,11 @@ exports[`api/github getFileContent(filePatch, branchName) should return null if
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -725,7 +793,11 @@ exports[`api/github getFileContent(filePatch, branchName) should return the enco
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -750,7 +822,11 @@ exports[`api/github getFileJson(filePatch, branchName) should return null if inv
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -775,7 +851,11 @@ exports[`api/github getFileJson(filePatch, branchName) should return the file co
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1030,7 +1110,11 @@ exports[`api/github getSubDirectories(path) should return subdirectories 1`] = `
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1085,7 +1169,11 @@ exports[`api/github initRepo should initialise the config for the repo - 0 1`] =
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1114,7 +1202,11 @@ exports[`api/github initRepo should initialise the config for the repo - 1 1`] =
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1143,7 +1235,11 @@ exports[`api/github initRepo should initialise the config for the repo - 2 1`] =
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1204,7 +1300,11 @@ exports[`api/github mergeBranch(branchName, mergeType) should perform a branch-m
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1256,7 +1356,11 @@ exports[`api/github mergeBranch(branchName, mergeType) should perform a branch-p
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1313,7 +1417,11 @@ exports[`api/github mergeBranch(branchName, mergeType) should throw if branch-me
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1356,7 +1464,11 @@ exports[`api/github mergeBranch(branchName, mergeType) should throw if branch-pu
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1402,7 +1514,11 @@ exports[`api/github mergeBranch(branchName, mergeType) should throw if unknown m
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",
@ -1431,7 +1547,11 @@ exports[`api/github setBaseBranch(branchName) sets the base branch 1`] = `
Array [
Array [
"repos/some/repo",
undefined,
Object {
"headers": Object {
"accept": "application/vnd.github.loki-preview+json",
},
},
],
Array [
"repos/some/repo/git/refs/heads/master",