using Elsa.Http.Abstractions;
using Elsa.Http.Contexts;
namespace Elsa.Http.DownloadableContentHandlers;
///
/// Handles content that represents a downloadable stream.
///
public class HttpFileDownloadableContentHandler : DownloadableContentHandlerBase
{
///
public override bool GetSupportsContent(object content) => content is HttpFile;
///
protected override Downloadable GetDownloadable(DownloadableContext context)
{
var file = (HttpFile)context.Content;
var stream = file.Stream;
var fileName = file.Filename;
var contentType = file.ContentType;
return new Downloadable(stream, fileName, contentType);
}
}