Browse Source

Address Copilot review feedback

- Drop manual HttpResponseMessage dispose in DownloadSourceCodeContentAsync,
  consistent with Volo.Abp.Http.Client.ClientProxyBase and ASP.NET Core OAuth
  handlers (default HttpCompletionOption.ResponseContentRead does not need
  manual disposal)
- Fix "occured" -> "occurred" typos in two log lines
- Remove unused using Microsoft.Extensions.Options from test
pull/25443/head
maliming 5 months ago
parent
commit
884768448e
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 9
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs
  2. 1
      framework/test/Volo.Abp.Cli.Core.Tests/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler_Tests.cs

9
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs

@ -248,7 +248,7 @@ public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency
} }
catch (Exception ex) when (ex is not CliUsageException) catch (Exception ex) when (ex is not CliUsageException)
{ {
Console.WriteLine("Error occured while getting the latest version from {0} : {1}", url, ex.Message); Console.WriteLine("Error occurred while getting the latest version from {0} : {1}", url, ex.Message);
return null; return null;
} }
} }
@ -351,10 +351,7 @@ public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency
} }
await EnsureAbpIoSuccessfulResponseAsync(responseMessage); await EnsureAbpIoSuccessfulResponseAsync(responseMessage);
var resultAsBytes = await responseMessage.Content.ReadAsByteArrayAsync(); return await responseMessage.Content.ReadAsByteArrayAsync();
responseMessage.Dispose();
return resultAsBytes;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -369,7 +366,7 @@ public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency
throw; throw;
} }
Console.WriteLine("Error occured while downloading source-code from {0} : {1}{2}{3}", url, Console.WriteLine("Error occurred while downloading source-code from {0} : {1}{2}{3}", url,
responseMessage?.ToString(), Environment.NewLine, ex.Message); responseMessage?.ToString(), Environment.NewLine, ex.Message);
throw; throw;
} }

1
framework/test/Volo.Abp.Cli.Core.Tests/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler_Tests.cs

@ -2,7 +2,6 @@ using System;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Shouldly; using Shouldly;
using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.Json.SystemTextJson; using Volo.Abp.Json.SystemTextJson;

Loading…
Cancel
Save