< Summary

Information
Class: Elsa.Http.HttpEndpointBase<T>
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Activities/HttpEndpointBase.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 42
Line coverage: 0%
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
OnHttpRequestReceivedAsync(...)100%210%
OnHttpRequestReceived(...)100%210%
ExecuteAsync()100%210%
GetTriggerPayloads(...)100%210%
HttpRequestReceivedAsync()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Activities/HttpEndpointBase.cs

#LineLine coverage
 1using Elsa.Http.Extensions;
 2using Elsa.Workflows;
 3using Microsoft.AspNetCore.Http;
 4
 5namespace Elsa.Http;
 6
 7public abstract class HttpEndpointBase : HttpEndpointBase<object>;
 8
 9public abstract class HttpEndpointBase<TResult> : Trigger<TResult>
 10{
 11    protected abstract HttpEndpointOptions GetOptions();
 12
 13    protected virtual ValueTask OnHttpRequestReceivedAsync(ActivityExecutionContext activityExecutionContext, HttpContex
 14    {
 015        OnHttpRequestReceived(activityExecutionContext, httpContext);
 016        return default;
 17    }
 18
 19    protected virtual void OnHttpRequestReceived(ActivityExecutionContext activityExecutionContext, HttpContext httpCont
 20    {
 021    }
 22
 23    protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
 24    {
 025        var options = GetOptions();
 026        await context.WaitForHttpRequestAsync(options, HttpRequestReceivedAsync);
 027    }
 28
 29    protected override IEnumerable<object> GetTriggerPayloads(TriggerIndexingContext context)
 30    {
 031        var options = GetOptions();
 032        context.TriggerName = HttpStimulusNames.HttpEndpoint;
 033        return context.GetHttpEndpointStimuli(options);
 34    }
 35
 36    private async ValueTask HttpRequestReceivedAsync(ActivityExecutionContext context)
 37    {
 038        var httpContext = context.GetRequiredService<IHttpContextAccessor>().HttpContext!;
 039        await OnHttpRequestReceivedAsync(context, httpContext);
 040        await context.CompleteActivityAsync();
 041    }
 42}