Fix HTTP Endpoint activity

This commit is contained in:
Sipke Schoorstra 2023-09-20 22:02:37 +02:00
parent a0ef307ff6
commit a4750883f5
3 changed files with 12 additions and 6 deletions

View file

@ -3,7 +3,6 @@ using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.Http.Bookmarks;
using Elsa.Http.Contracts;
using Elsa.Http.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;
@ -19,6 +18,7 @@ namespace Elsa.Http;
/// Wait for an inbound HTTP request that matches the specified path and methods.
/// </summary>
[Activity("Elsa", "HTTP", "Wait for an inbound HTTP request that matches the specified path and methods.", DisplayName = "HTTP Endpoint")]
[Output(IsSerializable = false)]
public class HttpEndpoint : Trigger<HttpRequest>
{
internal const string HttpContextInputKey = "HttpContext";
@ -101,7 +101,7 @@ public class HttpEndpoint : Trigger<HttpRequest>
/// <summary>
/// The uploaded files, if any.
/// </summary>
[Output(Description = "The uploaded files, if any.")]
[Output(Description = "The uploaded files, if any.", IsSerializable = false)]
public Output<IFormFile[]> Files { get; set; } = default!;
/// <summary>
@ -212,7 +212,7 @@ public class HttpEndpoint : Trigger<HttpRequest>
private IFormFileCollection ReadFilesAsync(ActivityExecutionContext context, HttpRequest request)
{
return request.Form.Files;
return request.HasFormContentType ? request.Form.Files : new FormFileCollection();
}
private async Task<bool> ValidateFileSizesAsync(ActivityExecutionContext context, HttpContext httpContext, IFormFileCollection files)

View file

@ -1,6 +1,6 @@
namespace Elsa.Workflows.Core.Attributes;
[AttributeUsage(AttributeTargets.Property)]
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]
public class OutputAttribute : Attribute
{
/// <summary>
@ -22,4 +22,9 @@ public class OutputAttribute : Attribute
/// A value indicating whether this property should be visible.
/// </summary>
public bool IsBrowsable { get; set; } = true;
/// <summary>
/// A value indicating whether this output can be serialized.
/// </summary>
public bool IsSerializable { get; set; } = true;
}

View file

@ -19,7 +19,7 @@ public abstract class Argument
protected Argument(MemoryBlockReference memoryBlockReference) : this(() => memoryBlockReference)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Argument"/> class.
/// </summary>
@ -32,5 +32,6 @@ public abstract class Argument
/// <summary>
/// Gets or sets the memory block reference.
/// </summary>
[JsonIgnore] public Func<MemoryBlockReference> MemoryBlockReference { get; set; } = default!;
[JsonIgnore]
public Func<MemoryBlockReference> MemoryBlockReference { get; set; } = default!;
}