Skip to content

Commit

Permalink
Push HTTP request cancellation token down into handlers.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Hoff <phillip@orst.edu>
  • Loading branch information
philliphoff committed Dec 5, 2023
1 parent ebe2e5e commit c12de4e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static IEndpointConventionBuilder MapActorMethodEndpoint(this IEndpointR
try
{
var (header, body) = await runtime.DispatchWithRemotingAsync(actorTypeName, actorId, methodName, daprActorheader, context.Request.Body);
var (header, body) = await runtime.DispatchWithRemotingAsync(actorTypeName, actorId, methodName, daprActorheader, context.Request.Body, context.RequestAborted);

Check warning on line 106 in src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs

View check run for this annotation

Codecov / codecov/patch

src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs#L106

Added line #L106 was not covered by tests
// Item 1 is header , Item 2 is body
if (header != string.Empty)
Expand All @@ -112,14 +112,14 @@ private static IEndpointConventionBuilder MapActorMethodEndpoint(this IEndpointR
context.Response.Headers[Constants.ErrorResponseHeaderName] = header; // add error header
}
await context.Response.Body.WriteAsync(body, 0, body.Length); // add response message body
await context.Response.Body.WriteAsync(body, 0, body.Length, context.RequestAborted); // add response message body

Check warning on line 115 in src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs

View check run for this annotation

Codecov / codecov/patch

src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs#L115

Added line #L115 was not covered by tests
}
catch (Exception ex)
{
var (header, body) = CreateExceptionResponseMessage(ex);
context.Response.Headers[Constants.ErrorResponseHeaderName] = header;
await context.Response.Body.WriteAsync(body, 0, body.Length);
await context.Response.Body.WriteAsync(body, 0, body.Length, context.RequestAborted);

Check warning on line 122 in src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs

View check run for this annotation

Codecov / codecov/patch

src/Dapr.Actors.AspNetCore/ActorsEndpointRouteBuilderExtensions.cs#L122

Added line #L122 was not covered by tests
}
finally
{
Expand All @@ -130,7 +130,7 @@ private static IEndpointConventionBuilder MapActorMethodEndpoint(this IEndpointR
{
try
{
await runtime.DispatchWithoutRemotingAsync(actorTypeName, actorId, methodName, context.Request.Body, context.Response.Body);
await runtime.DispatchWithoutRemotingAsync(actorTypeName, actorId, methodName, context.Request.Body, context.Response.Body, context.RequestAborted);
}
finally
{
Expand Down

0 comments on commit c12de4e

Please sign in to comment.