Skip to content

Commit

Permalink
SLVS-1732 Rename field
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriela-trutan-sonarsource committed Dec 24, 2024
1 parent 189062b commit 43eb67f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/SonarQube.Client/SonarQubeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> 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<bool>(hasOrganisations);
}
Expand Down Expand Up @@ -125,7 +125,7 @@ private Task<TResponse> InvokeCheckedRequestAsync<TRequest, TResponse>(
private async Task<TResponse> InvokeUncheckedRequestAsync<TRequest, TResponse>(Action<TRequest> configure, CancellationToken token)
where TRequest : IRequest<TResponse>
{
return await InvokeUncheckedRequestAsync<TRequest, TResponse>(configure, httpClient, token);
return await InvokeUncheckedRequestAsync<TRequest, TResponse>(configure, currentHttpClient, token);
}

/// <summary>
Expand Down Expand Up @@ -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<IValidateCredentialsRequest, bool>(request => { }, token);
Expand Down Expand Up @@ -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<IList<SonarQubeQualityProfile>> GetAllQualityProfilesAsync(string project, string organizationKey, CancellationToken token)
Expand Down Expand Up @@ -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)
Expand All @@ -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<string> GetSourceCodeAsync(string fileKey, CancellationToken token) =>
Expand Down

0 comments on commit 43eb67f

Please sign in to comment.