Updated the URL trimming logic to ensure consistent handling of base URLs and paths, removing trailing slashes where necessary. This change improves the consistency and reliability of URL generation.
28 lines
915 B
C#
28 lines
915 B
C#
using System.Reflection;
|
|
using Elsa.Workflows;
|
|
using Elsa.Workflows.UIHints;
|
|
using Elsa.Workflows.UIHints.SingleLine;
|
|
|
|
namespace Elsa.Http.UIHints;
|
|
|
|
/// <summary>
|
|
/// Provides additional options for the Path input field.
|
|
/// </summary>
|
|
public class HttpEndpointPathUIHandler(IHttpEndpointBasePathProvider httpEndpointBasePathProvider) : IPropertyUIHandler
|
|
{
|
|
/// <inheritdoc />
|
|
public ValueTask<IDictionary<string, object>> GetUIPropertiesAsync(PropertyInfo propertyInfo, object? context, CancellationToken cancellationToken = default)
|
|
{
|
|
var completeBaseUrl = httpEndpointBasePathProvider.GetBasePath();
|
|
|
|
return new(new Dictionary<string, object>
|
|
{
|
|
[InputUIHints.SingleLine] = new SingleLineProps
|
|
{
|
|
AdornmentText = completeBaseUrl,
|
|
EnableCopyAdornment = true
|
|
},
|
|
["Refresh"] = true
|
|
});
|
|
}
|
|
} |