diff --git a/Mohaymen.GiteaClient.Tests/Gitea/File/CreateFile/Commands/CreateFileCommandHandlerTests.cs b/Mohaymen.GiteaClient.Tests/Gitea/File/CreateFile/Commands/CreateFileCommandHandlerTests.cs index cc3a26a..a21e055 100644 --- a/Mohaymen.GiteaClient.Tests/Gitea/File/CreateFile/Commands/CreateFileCommandHandlerTests.cs +++ b/Mohaymen.GiteaClient.Tests/Gitea/File/CreateFile/Commands/CreateFileCommandHandlerTests.cs @@ -52,7 +52,7 @@ public async Task Handle_ShouldThrowsValidationException_WhenInputIsInvalid() } [Fact] - public async Task Handle_ShouldCallCreateFileAsync_AndInputsAreValid() + public async Task Handle_ShouldCallCreateFileAsync_WhenInputsAreValid() { // Arrange _validator.RuleFor(x => x).Must(_ => true); diff --git a/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs b/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs index 1d2bffe..00fb989 100644 --- a/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs +++ b/Mohaymen.GiteaClient/Gitea/File/GetFile/Commands/GetFileCommand.cs @@ -45,7 +45,8 @@ public async Task> Handle(GetFileCommand command var owner = _options.Value.RepositoriesOwner; var apiResponse = await _fileRestClient.GetFileAsync(owner, command.RepositoryName, command.FilePath, getFileRequest, cancellationToken) .ConfigureAwait(false); - if (apiResponse?.Content != null) + await apiResponse.EnsureSuccessStatusCodeAsync(); + if (apiResponse.Content is not null) { apiResponse.Content.Content = _contentDecoder.Base64Decode(apiResponse.Content.Content); }