Use the API URL from the environment if it is present.

This commit is contained in:
Chris Gavin 2022-08-10 21:11:50 +01:00
parent a6d09016e7
commit bbdc9efa94
No known key found for this signature in database
GPG key ID: 07F950B80C27E4DA
42 changed files with 122 additions and 22 deletions

11
lib/api-client.test.js generated
View file

@ -81,6 +81,17 @@ ava_1.default.beforeEach(() => {
userAgent: `CodeQL-Action/${pkg.version}`,
});
});
(0, ava_1.default)("Get the API with an API URL directly", async (t) => {
doTest(t, {
auth: "xyz",
url: "http://github.localhost",
apiURL: "http://api.github.localhost",
}, undefined, {
auth: "token xyz",
baseUrl: "http://api.github.localhost",
userAgent: `CodeQL-Action/${pkg.version}`,
});
});
function doTest(t, clientArgs, clientOptions, expected) {
(0, api_client_1.getApiClient)(clientArgs, clientOptions);
const firstCallArgs = githubStub.args[0];