From 34559e3dbdf0ad48668d94da28fb306bd19e915d Mon Sep 17 00:00:00 2001 From: Christian Simonsson Date: Mon, 19 Aug 2024 11:38:37 +0200 Subject: [PATCH] Minor changes to fix ExcludeRequestSpecialTypes --- src/IdempotentAPI/Core/Idempotency.cs | 4 +++- .../Extensions/DependencyInjection/IdempotentAPIExtensions.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/IdempotentAPI/Core/Idempotency.cs b/src/IdempotentAPI/Core/Idempotency.cs index e26c746..569f254 100644 --- a/src/IdempotentAPI/Core/Idempotency.cs +++ b/src/IdempotentAPI/Core/Idempotency.cs @@ -193,7 +193,9 @@ and not HttpContext and not HttpResponse and not ClaimsPrincipal and not CancellationToken) - && (_excludeRequestSpecialTypes is null || (_excludeRequestSpecialTypes is not null && !_excludeRequestSpecialTypes.Contains(a.GetType()))) + && (_excludeRequestSpecialTypes is null || + (_excludeRequestSpecialTypes is not null && + !_excludeRequestSpecialTypes.Any(t => a.GetType() == t || a.GetType().IsSubclassOf(t)))) ).ToList(); string requestsDataHash = await GenerateRequestsDataHashMinimalApiAsync(filteredArguments, httpContext.Request); diff --git a/src/IdempotentAPI/Extensions/DependencyInjection/IdempotentAPIExtensions.cs b/src/IdempotentAPI/Extensions/DependencyInjection/IdempotentAPIExtensions.cs index a7ad418..e1a5030 100644 --- a/src/IdempotentAPI/Extensions/DependencyInjection/IdempotentAPIExtensions.cs +++ b/src/IdempotentAPI/Extensions/DependencyInjection/IdempotentAPIExtensions.cs @@ -59,7 +59,9 @@ public static IServiceCollection AddIdempotentMinimalAPI(this IServiceCollection TimeSpan.FromMilliseconds(idempotencyOptions.DistributedLockTimeoutMilli), idempotencyOptions.CacheOnlySuccessResponses, idempotencyOptions.IsIdempotencyOptional, - idempotencyOptions.SerializerSettings); + idempotencyOptions.SerializerSettings, + idempotencyOptions.ExcludeRequestSpecialTypes + ); }); return serviceCollection;