diff --git a/src/SonarQube.Client/SonarQubeService.cs b/src/SonarQube.Client/SonarQubeService.cs index 6929f0efb..1088ffef2 100644 --- a/src/SonarQube.Client/SonarQubeService.cs +++ b/src/SonarQube.Client/SonarQubeService.cs @@ -579,7 +579,7 @@ private static bool ShouldUseBearer(ServerInfo serverInfo) private async Task GetServerInfo(ConnectionInformation connection, CancellationToken token) { - var http = CreateHttpClient(connection.ServerUri, new NoCredentials(), shouldUseBearer:true); + var http = CreateHttpClient(connection.ServerUri, new NoCredentials(), shouldUseBearer: true); var versionResponse = await InvokeUncheckedRequestAsync(request => { }, http, token); var serverInfo = new ServerInfo(Version.Parse(versionResponse), connection.IsSonarCloud ? ServerType.SonarCloud : ServerType.SonarQube); return serverInfo; @@ -587,14 +587,7 @@ private async Task GetServerInfo(ConnectionInformation connection, C private HttpClient CreateHttpClient(Uri baseAddress, IConnectionCredentials credentials, bool shouldUseBearer) { - var client = new HttpClient(messageHandler) - { - BaseAddress = baseAddress, - DefaultRequestHeaders = - { - Authorization = AuthenticationHeaderFactory.Create(credentials, shouldUseBearer), - }, - }; + var client = new HttpClient(messageHandler) { BaseAddress = baseAddress, DefaultRequestHeaders = { Authorization = AuthenticationHeaderFactory.Create(credentials, shouldUseBearer), }, }; client.DefaultRequestHeaders.Add("User-Agent", userAgent); return client; }