< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.WorkflowInstances.Cancel.Cancel
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/Cancel/Endpoint.cs
Line coverage
62%
Covered lines: 5
Uncovered lines: 3
Coverable lines: 8
Total lines: 26
Line coverage: 62.5%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Configure()100%11100%
HandleAsync()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/WorkflowInstances/Cancel/Endpoint.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Runtime;
 3using JetBrains.Annotations;
 4using Microsoft.AspNetCore.Http;
 5
 6namespace Elsa.Workflows.Api.Endpoints.WorkflowInstances.Cancel;
 7
 8[PublicAPI]
 19internal class Cancel(IWorkflowCancellationService workflowCancellationService)
 10    : ElsaEndpoint<Request>
 11{
 12    public override void Configure()
 13    {
 114        Post("/cancel/workflow-instances/{id}");
 115        ConfigurePermissions("cancel:workflow-instances");
 16        //Allows for post with empty body
 217        Description(x => x.Accepts<Request>("*/*"), clearDefaults: true);
 118    }
 19
 20    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 21    {
 022        await workflowCancellationService.CancelWorkflowAsync(request.Id, cancellationToken);
 23
 024        await Send.OkAsync(cancellationToken);
 025    }
 26}