Skip to content

Commit

Permalink
build(update-endpoints): handle special case for `octokit.repos.uploa…
Browse files Browse the repository at this point in the history
…dReleaseAsset`
  • Loading branch information
gr2m committed Jan 31, 2020
1 parent 6eb4063 commit 4abd16e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/update-endpoints/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ async function generateRoutes() {
return;
}

const isUploadReleaseAssetUrl = /^\{origin\}/.test(endpoint.url);
if (isUploadReleaseAssetUrl) {
endpoint.url = endpoint.url.substr("{origin}".length);
}

const idName = endpoint.id;
const route = `${endpoint.method} ${endpoint.url}`;
const endpointDefaults = {};
Expand Down Expand Up @@ -96,6 +101,10 @@ async function generateRoutes() {
}
}

if (isUploadReleaseAssetUrl) {
endpointDefaults.baseUrl = "https://uploads.github.com";
}

newRoutes[scope][idName] = [route];

if (Object.keys(endpointDecorations).length) {
Expand Down

0 comments on commit 4abd16e

Please sign in to comment.