< Summary

Information
Class: Elsa.Http.Services.DefaultHttpEndpointRoutesProvider
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Services/DefaultHttpEndpointRoutesProvider.cs
Line coverage
92%
Covered lines: 12
Uncovered lines: 1
Coverable lines: 13
Total lines: 36
Line coverage: 92.3%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
GetRoutesAsync(...)100%11100%
GetRoutes(...)50%2290%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Services/DefaultHttpEndpointRoutesProvider.cs

#LineLine coverage
 1using Elsa.Extensions;
 2using Elsa.Http.Contexts;
 3using Elsa.Http.Options;
 4using JetBrains.Annotations;
 5using Microsoft.Extensions.Options;
 6
 7namespace Elsa.Http.Services;
 8
 9/// <summary>
 10/// Provides a route for an HTTP endpoint based on the specified context.
 11/// </summary>
 12[UsedImplicitly]
 32313public class DefaultHttpEndpointRoutesProvider(IOptions<HttpActivityOptions> options) : IHttpEndpointRoutesProvider
 14{
 15    public Task<IEnumerable<HttpRouteData>> GetRoutesAsync(HttpEndpointRouteProviderContext context)
 16    {
 6217        var routes = GetRoutes(context);
 6218        return Task.FromResult(routes);
 19    }
 20
 21    private IEnumerable<HttpRouteData> GetRoutes(HttpEndpointRouteProviderContext context)
 22    {
 6223        var routes = new List<HttpRouteData>();
 6224        var path = context.Payload.Path;
 25
 6226        if (string.IsNullOrWhiteSpace(path))
 027            return routes;
 28
 6229        var routeData = new HttpRouteData(new[]
 6230        {
 6231            options.Value.BasePath.ToString(), path
 6232        }.JoinSegments());
 6233        routes.Add(routeData);
 6234        return routes;
 35    }
 36}