diff --git a/lib/util/http/github.spec.ts b/lib/util/http/github.spec.ts index 9ce3ae1422e92dfcbd58d24e71f2051a6b03a4c0..dc9c5b6ddf50821899d0d3627f5343cc7c20cfaf 100644 --- a/lib/util/http/github.spec.ts +++ b/lib/util/http/github.spec.ts @@ -218,12 +218,12 @@ describe(getName(__filename), () => { const repository = { foo: 'foo', bar: 'bar' }; httpMock .scope('https://ghe.mycompany.com') - .post('/graphql') + .post('/api/graphql') .reply(200, { data: { repository } }); await githubApi.queryRepo(query); const [req] = httpMock.getTrace(); expect(req).toBeDefined(); - expect(req.url).toEqual('https://ghe.mycompany.com/graphql'); + expect(req.url).toEqual('https://ghe.mycompany.com/api/graphql'); }); it('supports app mode', async () => { hostRules.add({ hostType: 'github', token: 'x-access-token:abc123' }); diff --git a/lib/util/http/github.ts b/lib/util/http/github.ts index cd4a6638491f966aad4ba64d6beb2030b7cf1917..5c53567c394f854d88b68019cbd91c9444c2de69 100644 --- a/lib/util/http/github.ts +++ b/lib/util/http/github.ts @@ -220,10 +220,8 @@ export class GithubHttp extends Http<GithubHttpOptions, GithubHttpOptions> { const path = 'graphql'; - const { origin } = new URL(baseUrl); - const opts: HttpPostOptions = { - baseUrl: origin, + baseUrl: baseUrl.replace('/v3/', '/'), // GHE uses unversioned graphql path body: { query }, headers: { accept: options?.acceptHeader }, };