From 68a502509686e40029b9996fcab3277e39bdbaa2 Mon Sep 17 00:00:00 2001 From: Lilian Kasem Date: Wed, 11 Dec 2024 14:19:21 -0800 Subject: [PATCH] Remove use of an invocation's CT in DefaultFromBodyConversionFeature --- .../src/DefaultFromBodyConversionFeature.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/Worker.Extensions.Http/src/DefaultFromBodyConversionFeature.cs b/extensions/Worker.Extensions.Http/src/DefaultFromBodyConversionFeature.cs index 3708fb68..df7bc488 100644 --- a/extensions/Worker.Extensions.Http/src/DefaultFromBodyConversionFeature.cs +++ b/extensions/Worker.Extensions.Http/src/DefaultFromBodyConversionFeature.cs @@ -56,11 +56,11 @@ internal class DefaultFromBodyConversionFeature : IFromBodyConversionFeature } else if (targetType == typeof(byte[])) { - result = ReadBytes(requestData, context.CancellationToken); // Why is this using the invocations CancellationToken? + result = ReadBytes(requestData); } else if (targetType == typeof(Memory)) { - Memory bytes = ReadBytes(requestData, context.CancellationToken); // Why is this using the invocations CancellationToken? + Memory bytes = ReadBytes(requestData); result = bytes; } else if (HasJsonContentType(requestData)) @@ -68,7 +68,7 @@ internal class DefaultFromBodyConversionFeature : IFromBodyConversionFeature ObjectSerializer serializer = requestData.FunctionContext.InstanceServices.GetService>()?.Value?.Serializer ?? throw new InvalidOperationException("A serializer is not configured for the worker."); - result = serializer.Deserialize(requestData.Body, targetType, context.CancellationToken); // Why is this using the invocations CancellationToken? + result = serializer.Deserialize(requestData.Body, targetType); } else { @@ -78,7 +78,7 @@ internal class DefaultFromBodyConversionFeature : IFromBodyConversionFeature return new ValueTask(result); } - private static byte[] ReadBytes(HttpRequestData requestData, CancellationToken cancellationToken) + private static byte[] ReadBytes(HttpRequestData requestData) { var bytes = new byte[requestData.Body.Length]; requestData.Body.Read(bytes, 0, bytes.Length);