< Summary

Information
Class: Elsa.Http.DownloadableContentHandlers.StreamDownloadableContentHandler
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/DownloadableContentHandlers/StreamDownloadableContentHandler.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 22
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
GetSupportsContent(...)100%210%
GetDownloadable(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/DownloadableContentHandlers/StreamDownloadableContentHandler.cs

#LineLine coverage
 1using Elsa.Http.Abstractions;
 2using Elsa.Http.Contexts;
 3
 4namespace Elsa.Http.DownloadableContentHandlers;
 5
 6/// <summary>
 7/// Handles content that represents a downloadable stream.
 8/// </summary>
 9public class StreamDownloadableContentHandler : DownloadableContentHandlerBase
 10{
 11    /// <inheritdoc />
 012    public override bool GetSupportsContent(object content) => content is Stream;
 13
 14    /// <inheritdoc />
 15    protected override Downloadable GetDownloadable(DownloadableContext context)
 16    {
 017        var stream = (Stream) context.Content;
 018        var fileName = "file.bin";
 019        var contentType = "application/octet-stream";
 020        return new Downloadable(stream, fileName, contentType);
 21    }
 22}