diff --git a/Refit.Tests/API/ApiApprovalTests.Refit.DotNet6_0.verified.txt b/Refit.Tests/API/ApiApprovalTests.Refit.DotNet6_0.verified.txt index 9b3d7dff7..34fd210ce 100644 --- a/Refit.Tests/API/ApiApprovalTests.Refit.DotNet6_0.verified.txt +++ b/Refit.Tests/API/ApiApprovalTests.Refit.DotNet6_0.verified.txt @@ -198,6 +198,15 @@ namespace Refit public interface IApiResponse : Refit.IApiResponse, System.IDisposable { T Content { get; } + new System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; } + new Refit.ApiException? Error { get; } + [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Error")] + [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")] + [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ContentHeaders")] + [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Error")] + [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")] + [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ContentHeaders")] + new bool IsSuccessStatusCode { get; } } public interface IFormUrlEncodedParameterFormatter { diff --git a/Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt b/Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt index 7295422ec..182ebd24d 100644 --- a/Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt +++ b/Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt @@ -198,6 +198,15 @@ namespace Refit public interface IApiResponse : Refit.IApiResponse, System.IDisposable { T Content { get; } + new System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; } + new Refit.ApiException? Error { get; } + [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Error")] + [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")] + [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ContentHeaders")] + [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Error")] + [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Content")] + [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ContentHeaders")] + new bool IsSuccessStatusCode { get; } } public interface IFormUrlEncodedParameterFormatter { diff --git a/Refit/ApiResponse.cs b/Refit/ApiResponse.cs index 259a58123..2867b8147 100644 --- a/Refit/ApiResponse.cs +++ b/Refit/ApiResponse.cs @@ -152,6 +152,31 @@ void Dispose(bool disposing) /// public interface IApiResponse : IApiResponse { +#if NET6_0_OR_GREATER + /// + /// The object in case of unsuccessful response. + /// + [SuppressMessage( + "Naming", + "CA1716:Identifiers should not match keywords", + Justification = "By Design" + )] + new ApiException? Error { get; } + + /// + /// HTTP response content headers as defined in RFC 2616. + /// + new HttpContentHeaders? ContentHeaders { get; } + + /// + /// Indicates whether the request was successful. + /// + [MemberNotNullWhen(true, nameof(Content))] + [MemberNotNullWhen(true, nameof(ContentHeaders))] + [MemberNotNullWhen(false, nameof(Error))] + new bool IsSuccessStatusCode { get; } +#endif + /// /// Deserialized request content as . ///