diff --git a/Directory.Build.props b/Directory.Build.props index 1694c5b65..a74ab1597 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -36,7 +36,7 @@ - + diff --git a/Refit.GeneratorTests/Refit.GeneratorTests.csproj b/Refit.GeneratorTests/Refit.GeneratorTests.csproj index 442eb0149..74506732f 100644 --- a/Refit.GeneratorTests/Refit.GeneratorTests.csproj +++ b/Refit.GeneratorTests/Refit.GeneratorTests.csproj @@ -20,7 +20,7 @@ - + diff --git a/Refit.GeneratorTests/ReturnTypeTests.cs b/Refit.GeneratorTests/ReturnTypeTests.cs index 1e9605b6e..099a888dd 100644 --- a/Refit.GeneratorTests/ReturnTypeTests.cs +++ b/Refit.GeneratorTests/ReturnTypeTests.cs @@ -1,6 +1,5 @@ -namespace Refit.GeneratorTests; +namespace Refit.GeneratorTests; -[UsesVerify] public class ReturnTypeTests { [Fact] diff --git a/Refit.Tests/API/ApiApprovalTests.Refit.DotNet6_0.verified.txt b/Refit.Tests/API/ApiApprovalTests.Refit.DotNet6_0.verified.txt index 15d17e534..f5e519fed 100644 --- a/Refit.Tests/API/ApiApprovalTests.Refit.DotNet6_0.verified.txt +++ b/Refit.Tests/API/ApiApprovalTests.Refit.DotNet6_0.verified.txt @@ -18,6 +18,8 @@ namespace Refit protected ApiException(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { } public string? Content { get; } public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; } + [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")] + [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")] public bool HasContent { get; } public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } public System.Net.Http.HttpMethod HttpMethod { get; } diff --git a/Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt b/Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt index 8c9b3cce6..cbe45beb8 100644 --- a/Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt +++ b/Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt @@ -18,6 +18,8 @@ namespace Refit protected ApiException(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { } public string? Content { get; } public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; } + [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")] + [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")] public bool HasContent { get; } public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } public System.Net.Http.HttpMethod HttpMethod { get; } diff --git a/Refit/ApiException.cs b/Refit/ApiException.cs index 5db3d5c5d..7959e7df3 100644 --- a/Refit/ApiException.cs +++ b/Refit/ApiException.cs @@ -1,4 +1,5 @@ -using System.Net; +using System.Diagnostics.CodeAnalysis; +using System.Net; using System.Net.Http; using System.Net.Http.Headers; @@ -53,6 +54,9 @@ public class ApiException : Exception /// /// Does the response have content? /// + #if NET6_0_OR_GREATER + [MemberNotNullWhen(true, nameof(Content))] + #endif public bool HasContent => !string.IsNullOrWhiteSpace(Content); /// diff --git a/version.json b/version.json index 20873affd..cc296dfba 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "7.1.2", + "version": "7.2.0", "publicReleaseRefSpec": [ "^refs/heads/main$", // we release out of main "^refs/heads/rel/v\\d+\\.\\d+" // we also release branches starting with vN.N