diff --git a/Apizr/Src/Apizr/ApizrHttpClient.cs b/Apizr/Src/Apizr/ApizrHttpClient.cs index e2a1cc26..2e1f3faa 100644 --- a/Apizr/Src/Apizr/ApizrHttpClient.cs +++ b/Apizr/Src/Apizr/ApizrHttpClient.cs @@ -27,8 +27,13 @@ public override async Task SendAsync(HttpRequestMessage req { return await base.SendAsync(request, cts?.Token ?? cancellationToken).ConfigureAwait(false); } + catch (TimeoutException ex) + when(ex.InnerException is OperationCanceledException cancelEx) // Actually a user cancellation (iOS) + { + throw cancelEx; + } catch (WebException ex) - when (optionsCancellationToken.IsCancellationRequested) // Actually a user cancellation + when (optionsCancellationToken.IsCancellationRequested) // Actually a user cancellation (Android) { throw new OperationCanceledException(ex.Message, ex); } diff --git a/Apizr/Src/Apizr/ApizrHttpMessageHandler.cs b/Apizr/Src/Apizr/ApizrHttpMessageHandler.cs index a9b34e49..b8076751 100644 --- a/Apizr/Src/Apizr/ApizrHttpMessageHandler.cs +++ b/Apizr/Src/Apizr/ApizrHttpMessageHandler.cs @@ -26,8 +26,13 @@ protected override async Task SendAsync(HttpRequestMessage { return await base.SendAsync(request, cts?.Token ?? cancellationToken).ConfigureAwait(false); } + catch (TimeoutException ex) + when (ex.InnerException is OperationCanceledException cancelEx) // Actually a user cancellation (iOS) + { + throw cancelEx; + } catch (WebException ex) - when (optionsCancellationToken.IsCancellationRequested) // Actually a user cancellation + when (optionsCancellationToken.IsCancellationRequested) // Actually a user cancellation (Android) { throw new OperationCanceledException(ex.Message, ex); } diff --git a/Apizr/Tests/Apizr.Tests.Maui/Apizr.Tests.Maui.csproj b/Apizr/Tests/Apizr.Tests.Maui/Apizr.Tests.Maui.csproj index f40b837f..45b7d76f 100644 --- a/Apizr/Tests/Apizr.Tests.Maui/Apizr.Tests.Maui.csproj +++ b/Apizr/Tests/Apizr.Tests.Maui/Apizr.Tests.Maui.csproj @@ -30,6 +30,11 @@ 6.5 + + Apple Development: Jerome Liger (PPVW2MK6ZH) + VS: WildCard Development + + diff --git a/Apizr/Tests/Apizr.Tests/Apis/IReqResResourceService.cs b/Apizr/Tests/Apizr.Tests/Apis/IReqResResourceService.cs index 4cfb7ffe..dbe900dc 100644 --- a/Apizr/Tests/Apizr.Tests/Apis/IReqResResourceService.cs +++ b/Apizr/Tests/Apizr.Tests/Apis/IReqResResourceService.cs @@ -7,7 +7,7 @@ //[assembly:Log] namespace Apizr.Tests.Apis { - [WebApi, Log(HttpMessageParts.None)] + [WebApi("https://reqres.in/api"), Log(HttpMessageParts.None)] public interface IReqResResourceService { [Get("/unknown")] diff --git a/Apizr/Tests/Apizr.Tests/ApizrTests.cs b/Apizr/Tests/Apizr.Tests/ApizrTests.cs index 36184de1..2246be52 100644 --- a/Apizr/Tests/Apizr.Tests/ApizrTests.cs +++ b/Apizr/Tests/Apizr.Tests/ApizrTests.cs @@ -701,7 +701,7 @@ public async Task Cancelling_A_Get_Request_Should_Throw_An_OperationCanceledExce ex.WithInnerException(); } - [Fact] + [Fact] // todo: iOS fix => TimeoutException public async Task Cancelling_A_Post_Request_Should_Throw_An_OperationCanceledException() { var manager = ApizrBuilder.Current.CreateManagerFor();