chore: re-ask for the code-coverage url before fetching

Signed-off-by: Anton Ganhammar <ganhammar@gmail.com>
This commit is contained in:
Anton Ganhammar
2023-08-18 15:07:14 +02:00
parent 850ca8eb10
commit a80f321353
+2 -6
View File
@@ -48,8 +48,6 @@ export class CodeCoverageRestApi implements CodeCoverageApi {
private readonly discoveryApi: DiscoveryApi;
private readonly fetchApi: FetchApi;
private url: string = '';
public constructor(options: {
discoveryApi: DiscoveryApi;
fetchApi: FetchApi;
@@ -61,10 +59,8 @@ export class CodeCoverageRestApi implements CodeCoverageApi {
private async fetch<T = unknown | string | JsonCoverageHistory>(
path: string,
): Promise<T | string> {
if (!this.url) {
this.url = await this.discoveryApi.getBaseUrl('code-coverage');
}
const resp = await this.fetchApi.fetch(`${this.url}${path}`);
const url = await this.discoveryApi.getBaseUrl('code-coverage');
const resp = await this.fetchApi.fetch(`${url}${path}`);
if (!resp.ok) {
throw await ResponseError.fromResponse(resp);
}