From 83c7abe87ab65cd8c21afb0e8c3e263f17590876 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Mon, 2 May 2016 14:37:34 -0700 Subject: [PATCH] Dipose HttpClient --- .../TestRunner.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.AspNetCore.Localization.FunctionalTests/TestRunner.cs b/test/Microsoft.AspNetCore.Localization.FunctionalTests/TestRunner.cs index ed126a7023..f7e59bc37a 100644 --- a/test/Microsoft.AspNetCore.Localization.FunctionalTests/TestRunner.cs +++ b/test/Microsoft.AspNetCore.Localization.FunctionalTests/TestRunner.cs @@ -73,15 +73,16 @@ namespace Microsoft.AspNetCore.Localization.FunctionalTests var httpClientHandler = new HttpClientHandler(); httpClientHandler.CookieContainer = cookieContainer; - var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; - - // Request to base address and check if various parts of the body are rendered & measure the cold startup time. - var response = await RetryHelper.RetryRequest(() => + using (var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }) { - return httpClient.GetAsync(string.Empty); - }, logger, deploymentResult.HostShutdownToken); + // Request to base address and check if various parts of the body are rendered & measure the cold startup time. + var response = await RetryHelper.RetryRequest(() => + { + return httpClient.GetAsync(string.Empty); + }, logger, deploymentResult.HostShutdownToken); - return await response.Content.ReadAsStringAsync(); + return await response.Content.ReadAsStringAsync(); + } } } }