Skip to content

Commit

Permalink
Remove use of an invocation's CT in DefaultFromBodyConversionFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
liliankasem committed Dec 11, 2024
1 parent 15bbc50 commit 68a5025
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ 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<byte>))
{
Memory<byte> bytes = ReadBytes(requestData, context.CancellationToken); // Why is this using the invocations CancellationToken?
Memory<byte> bytes = ReadBytes(requestData);
result = bytes;
}
else if (HasJsonContentType(requestData))
{
ObjectSerializer serializer = requestData.FunctionContext.InstanceServices.GetService<IOptions<WorkerOptions>>()?.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);

Check failure on line 71 in extensions/Worker.Extensions.Http/src/DefaultFromBodyConversionFeature.cs

View check run for this annotation

Azure Pipelines / dotnet-worker.public (Test Run integration tests - linux)

extensions/Worker.Extensions.Http/src/DefaultFromBodyConversionFeature.cs#L71

extensions/Worker.Extensions.Http/src/DefaultFromBodyConversionFeature.cs(71,37): Error CS7036: There is no argument given that corresponds to the required parameter 'cancellationToken' of 'ObjectSerializer.Deserialize(Stream, Type, CancellationToken)'
}
else
{
Expand All @@ -78,7 +78,7 @@ internal class DefaultFromBodyConversionFeature : IFromBodyConversionFeature
return new ValueTask<object?>(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);
Expand Down

0 comments on commit 68a5025

Please sign in to comment.