0

We have to access our instance of GHE through a proxy, which requires a port number to be added to the URL. We create an Octokit instance like

new Octokit({
    baseUrl: 'https://api.github.mycompany.com:5000',
...
}

We then get the page iterator as

Octokit.paginate.iterator(
  Octokit.rest.repos.listCommits,
  { ...options, per_page: 100 }
)

The first page comes through fine, but the subsequent page fails.

HttpError: request to https://api.github.mycompany.com/repositories/1/commits?sha=HEAD&per_page=100&page=2 failed

Note the lack of port. That doesn't really surprise me, since GitHub Enterprise doesn't know what port the proxy is using, of course.

Is there some way to communicate the port (or complete base URL) which will return a valid link header including the port? Or do we just have to resort to manual paging, parsing/modifying the link header as required?

4

1 回答 1

0

The solution we found was to override request.fetch on the Octokit constructor options, so that the URL could be rewritten as necessary.

于 2021-07-27T18:18:14.670 回答