IApiResponse<T> is no longer convertible to IApiResponse #1744
-
Hello! For some long time, I have been creating extension methods on top of IApiResponse and IApiResponse to make it easier to do some validations of responses, mainly in testing scenarios. From version 7.1.0, though, the code below no longer compiles: public static void ValidateSuccess(this IApiResponse response)
{
response.IsSuccessStatusCode.Should().BeTrue();
response.Error.Should().BeNull();
}
public static void ValidateCreated(this IApiResponse<CreationResponse> response,
Guid expectedId)
{
response.ValidateSuccess();
response.Content.Should().NotBeNull();
response.Content!.Id.Should().Be(expectedId);
} failing with an error:
Switching from IApiResponse to IApiResposeBase leads to losing the access to IsSuccessStatusCode and Error properties. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I will revert the change, at the time it seemed like a reasonable update, but extensions of the original should have been taken into consideration too, my apologies. |
Beta Was this translation helpful? Give feedback.
I will revert the change, at the time it seemed like a reasonable update, but extensions of the original should have been taken into consideration too, my apologies.
I will try to get a patch release out in the next couple of days.