Skip to content

Commit 36ffebb

Browse files
Adds usings for the http request, client and response
1 parent 801828d commit 36ffebb

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/Umbraco.Web/Install/InstallHelper.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal InstallHelper(UmbracoContext umbContext)
4141
public IEnumerable<InstallSetupStep> GetAllSteps()
4242
{
4343
return new List<InstallSetupStep>
44-
{
44+
{
4545
new NewInstallStep(_umbContext.Application),
4646
new UpgradeStep(),
4747
new FilePermissionsStep(),
@@ -87,12 +87,12 @@ internal void DeleteLegacyInstaller()
8787
{
8888
Directory.Move(IOHelper.MapPath(SystemDirectories.Install), IOHelper.MapPath("~/app_data/temp/install_backup"));
8989
}
90-
}
90+
}
9191

9292
if (Directory.Exists(IOHelper.MapPath("~/Areas/UmbracoInstall")))
93-
{
93+
{
9494
Directory.Delete(IOHelper.MapPath("~/Areas/UmbracoInstall"), true);
95-
}
95+
}
9696
}
9797

9898
internal void InstallStatus(bool isCompleted, string errorMsg)
@@ -193,14 +193,17 @@ internal IEnumerable<Package> GetStarterKits()
193193
{
194194
var requestUri = string.Format("http://our.umbraco.org/webapi/StarterKit/Get/?umbracoVersion={0}",
195195
UmbracoVersion.Current);
196-
var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
197-
var httpClient = new HttpClient();
198-
var response = httpClient.SendAsync(request).Result;
199-
packages = response.Content.ReadAsAsync<IEnumerable<Package>>().Result.ToList();
196+
197+
using (var request = new HttpRequestMessage(HttpMethod.Get, requestUri))
198+
using (var httpClient = new HttpClient())
199+
using (var response = httpClient.SendAsync(request).Result)
200+
{
201+
packages = response.Content.ReadAsAsync<IEnumerable<Package>>().Result.ToList();
202+
}
200203
}
201204
catch (AggregateException ex)
202205
{
203-
LogHelper.Error<InstallHelper>("Could not download list of available starter kits", ex);
206+
LogHelper.Error<InstallHelper>("Could not download list of available starter kits", ex);
204207
}
205208

206209
return packages;

0 commit comments

Comments
 (0)