2023-03-07 13:54:21 +00:00
|
|
|
using Elsa.Extensions;
|
|
|
|
|
using Elsa.Http.Models;
|
|
|
|
|
using Elsa.JavaScript.Notifications;
|
|
|
|
|
using Elsa.Mediator.Contracts;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
|
|
|
|
namespace Elsa.Http.Scripting.JavaScript;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Configures the JavaScript engine with workflow input getters.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[PublicAPI]
|
|
|
|
|
public class HttpJavaScriptHandler : INotificationHandler<EvaluatingJavaScript>
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
2023-08-14 12:47:35 +00:00
|
|
|
public Task HandleAsync(EvaluatingJavaScript notification, CancellationToken cancellationToken)
|
2023-03-07 13:54:21 +00:00
|
|
|
{
|
|
|
|
|
var engine = notification.Engine;
|
|
|
|
|
engine.RegisterType<HttpRequestHeaders>();
|
2023-08-14 12:47:35 +00:00
|
|
|
return Task.CompletedTask;
|
2023-03-07 13:54:21 +00:00
|
|
|
}
|
|
|
|
|
}
|