Minor cleanup
This commit is contained in:
parent
811827c393
commit
7ad3da2c2a
|
|
@ -12,11 +12,11 @@ namespace Elsa.Http.Scripting.JavaScript;
|
|||
[PublicAPI]
|
||||
public class HttpJavaScriptHandler : INotificationHandler<EvaluatingJavaScript>
|
||||
{
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task HandleAsync(EvaluatingJavaScript notification, CancellationToken cancellationToken)
|
||||
public Task HandleAsync(EvaluatingJavaScript notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var engine = notification.Engine;
|
||||
engine.RegisterType<HttpRequestHeaders>();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ public class RouteMatcher : IRouteMatcher
|
|||
|
||||
foreach (var parameter in parsedTemplate.Parameters)
|
||||
if (parameter.DefaultValue != null)
|
||||
result.Add(parameter.Name, parameter.DefaultValue);
|
||||
result.Add(parameter.Name!, parameter.DefaultValue);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,11 +149,11 @@ public class JintJavaScriptEvaluator : IJavaScriptEvaluator
|
|||
if (obj == null)
|
||||
return null!;
|
||||
|
||||
// If it's not an IEnumerable or it's a string or dictionary, return the original object
|
||||
// If it's not an IEnumerable or it's a string or dictionary, return the original object.
|
||||
if (obj is not IEnumerable enumerable || obj is string || obj is IDictionary)
|
||||
return obj;
|
||||
|
||||
// Use LINQ to convert the IEnumerable to an array
|
||||
// Use LINQ to convert the IEnumerable to an array.
|
||||
var elementType = obj.GetType().GetGenericArguments().FirstOrDefault();
|
||||
|
||||
if (elementType == null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue