Skip to content

Commit

Permalink
code review: Use simple using statement
Browse files Browse the repository at this point in the history
  • Loading branch information
raman-m committed Oct 12, 2023
1 parent 9e626a9 commit dbe00c5
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions test/Ocelot.IntegrationTests/AdministrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,11 @@ private void GivenIHaveAToken(string url)
};
var content = new FormUrlEncodedContent(formData);

using (var httpClient = new HttpClient())
{
var response = httpClient.PostAsync($"{url}/connect/token", content).Result;
var responseContent = response.Content.ReadAsStringAsync().Result;
response.EnsureSuccessStatusCode();
_token = JsonConvert.DeserializeObject<BearerToken>(responseContent);
}
using var httpClient = new HttpClient();
var response = httpClient.PostAsync($"{url}/connect/token", content).Result;
var responseContent = response.Content.ReadAsStringAsync().Result;
response.EnsureSuccessStatusCode();
_token = JsonConvert.DeserializeObject<BearerToken>(responseContent);
}

private void GivenThereIsAnIdentityServerOn(string url, string apiName)
Expand Down Expand Up @@ -596,11 +594,9 @@ private void GivenThereIsAnIdentityServerOn(string url, string apiName)

_identityServerBuilder.Start();

using (var httpClient = new HttpClient())
{
var response = httpClient.GetAsync($"{url}/.well-known/openid-configuration").Result;
response.EnsureSuccessStatusCode();
}
using var httpClient = new HttpClient();
var response = httpClient.GetAsync($"{url}/.well-known/openid-configuration").Result;
response.EnsureSuccessStatusCode();
}

private void GivenAnotherOcelotIsRunning(string baseUrl)
Expand Down

0 comments on commit dbe00c5

Please sign in to comment.