< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.Features.Get.Get
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/Features/Get/Endpoint.cs
Line coverage
36%
Covered lines: 4
Uncovered lines: 7
Coverable lines: 11
Total lines: 35
Line coverage: 36.3%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
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()0%620%

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Features.Contracts;
 3using Elsa.Features.Models;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Workflows.Api.Endpoints.Features.Get;
 7
 8/// <summary>
 9/// Returns the specified installed feature.
 10/// </summary>
 11[PublicAPI]
 312internal class Get(IInstalledFeatureProvider installedFeatureProvider) : ElsaEndpointWithoutRequest<FeatureDescriptor>
 13{
 14    /// <inheritdoc />
 15    public override void Configure()
 16    {
 317        Get("/features/installed/{fullName}");
 318        ConfigurePermissions("read:*", "read:installed-features");
 319    }
 20
 21    /// <inheritdoc />
 22    public override async Task HandleAsync( CancellationToken cancellationToken)
 23    {
 024        var fullName = Route<string>("fullName")!;
 025        var descriptor = installedFeatureProvider.Find(fullName);
 26
 027        if (descriptor == null)
 28        {
 029            await Send.NotFoundAsync(cancellationToken);
 030            return;
 31        }
 32
 033        await Send.OkAsync(descriptor, cancellationToken);
 034    }
 35}