diff --git a/src/SonarQube.Client/SonarQubeService.cs b/src/SonarQube.Client/SonarQubeService.cs index 531cdbb1f..6929f0efb 100644 --- a/src/SonarQube.Client/SonarQubeService.cs +++ b/src/SonarQube.Client/SonarQubeService.cs @@ -41,14 +41,14 @@ public class SonarQubeService : ISonarQubeService, IDisposable private readonly ISSEStreamReaderFactory sseStreamReaderFactory; private const string MinSqVersionSupportingBearer = "10.4"; - private HttpClient httpClient; + private HttpClient currentHttpClient; private ServerInfo currentServerInfo; public async Task HasOrganizations(CancellationToken token) { EnsureIsConnected(); - var hasOrganisations = httpClient.BaseAddress.Host.Equals("sonarcloud.io", StringComparison.OrdinalIgnoreCase); + var hasOrganisations = currentHttpClient.BaseAddress.Host.Equals("sonarcloud.io", StringComparison.OrdinalIgnoreCase); return await Task.FromResult(hasOrganisations); } @@ -125,7 +125,7 @@ private Task InvokeCheckedRequestAsync( private async Task InvokeUncheckedRequestAsync(Action configure, CancellationToken token) where TRequest : IRequest { - return await InvokeUncheckedRequestAsync(configure, httpClient, token); + return await InvokeUncheckedRequestAsync(configure, currentHttpClient, token); } /// @@ -158,7 +158,7 @@ public async Task ConnectAsync(ConnectionInformation connection, CancellationTok var serverInfo = await GetServerInfo(connection, token); logger.Info($"Connected to {serverTypeDescription} '{serverInfo.Version}'."); - httpClient = CreateHttpClient(connection.ServerUri, connection.Credentials, ShouldUseBearer(serverInfo)); + currentHttpClient = CreateHttpClient(connection.ServerUri, connection.Credentials, ShouldUseBearer(serverInfo)); logger.Debug($"Validating the credentials..."); var credentialResponse = await InvokeUncheckedRequestAsync(request => { }, token); @@ -247,7 +247,7 @@ public virtual Uri GetProjectDashboardUrl(string projectKey) var urlFormat = serverInfo.ServerType == ServerType.SonarCloud ? SonarCloud_ProjectDashboardRelativeUrl : SonarQube_ProjectDashboardRelativeUrl; - return new Uri(httpClient.BaseAddress, string.Format(urlFormat, projectKey)); + return new Uri(currentHttpClient.BaseAddress, string.Format(urlFormat, projectKey)); } public async Task> GetAllQualityProfilesAsync(string project, string organizationKey, CancellationToken token) @@ -473,7 +473,7 @@ public Uri GetViewIssueUrl(string projectKey, string issueKey) // Versioning: so far the format of the URL is the same across all versions from at least v6.7 const string ViewIssueRelativeUrl = "project/issues?id={0}&issues={1}&open={1}"; - return new Uri(httpClient.BaseAddress, string.Format(ViewIssueRelativeUrl, projectKey, issueKey)); + return new Uri(currentHttpClient.BaseAddress, string.Format(ViewIssueRelativeUrl, projectKey, issueKey)); } public Uri GetViewHotspotUrl(string projectKey, string hotspotKey) @@ -490,7 +490,7 @@ public Uri GetViewHotspotUrl(string projectKey, string hotspotKey) var urlFormat = serverInfo.ServerType == ServerType.SonarCloud ? SonarCloud_ViewHotspotRelativeUrl : SonarQube_ViewHotspotRelativeUrl; - return new Uri(httpClient.BaseAddress, string.Format(urlFormat, projectKey, hotspotKey)); + return new Uri(currentHttpClient.BaseAddress, string.Format(urlFormat, projectKey, hotspotKey)); } public async Task GetSourceCodeAsync(string fileKey, CancellationToken token) =>