diff --git a/Elsa.sln.DotSettings b/Elsa.sln.DotSettings index 5364ae8f1..79d4df8f1 100644 --- a/Elsa.sln.DotSettings +++ b/Elsa.sln.DotSettings @@ -1,4 +1,5 @@  + True True True True diff --git a/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs b/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs index 96a79681d..b1e83c0c8 100644 --- a/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs +++ b/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs @@ -5,7 +5,7 @@ using Elsa.Http.ContentWriters; using Elsa.Workflows.Core; using Elsa.Workflows.Core.Attributes; using Elsa.Workflows.Core.Models; -using HttpRequestHeaders = Elsa.Http.Models.HttpRequestHeaders; +using HttpHeaders = Elsa.Http.Models.HttpHeaders; namespace Elsa.Http; @@ -67,7 +67,7 @@ public abstract class SendHttpRequestBase : Activity /// The headers to send along with the request. /// [Input(Description = "The headers to send along with the request.", Category = "Advanced")] - public Input RequestHeaders { get; set; } = new(new HttpRequestHeaders()); + public Input RequestHeaders { get; set; } = new(new HttpHeaders()); /// /// The parsed content, if any. diff --git a/src/modules/Elsa.Http/Activities/WriteHttpResponse.cs b/src/modules/Elsa.Http/Activities/WriteHttpResponse.cs index 7fd01669e..5839cc29c 100644 --- a/src/modules/Elsa.Http/Activities/WriteHttpResponse.cs +++ b/src/modules/Elsa.Http/Activities/WriteHttpResponse.cs @@ -49,7 +49,7 @@ public class WriteHttpResponse : Activity /// The headers to return along with the response. /// [Input(Description = "The headers to send along with the response.", Category = "Advanced")] - public Input ResponseHeaders { get; set; } = new(new HttpResponseHeaders()); + public Input ResponseHeaders { get; set; } = new(new HttpHeaders()); /// protected override async ValueTask ExecuteAsync(ActivityExecutionContext context) diff --git a/src/modules/Elsa.Http/Features/HttpFeature.cs b/src/modules/Elsa.Http/Features/HttpFeature.cs index c90180e61..f9819f613 100644 --- a/src/modules/Elsa.Http/Features/HttpFeature.cs +++ b/src/modules/Elsa.Http/Features/HttpFeature.cs @@ -114,7 +114,7 @@ public class HttpFeature : FeatureBase typeof(HttpRequest), typeof(HttpResponse), typeof(HttpResponseMessage), - typeof(HttpRequestHeaders), + typeof(HttpHeaders), typeof(IFormFile) }, "HTTP"); diff --git a/src/modules/Elsa.Http/Models/HttpRequestHeaders.cs b/src/modules/Elsa.Http/Models/HttpHeaders.cs similarity index 55% rename from src/modules/Elsa.Http/Models/HttpRequestHeaders.cs rename to src/modules/Elsa.Http/Models/HttpHeaders.cs index 0ac5e91e7..1cbe03b8c 100644 --- a/src/modules/Elsa.Http/Models/HttpRequestHeaders.cs +++ b/src/modules/Elsa.Http/Models/HttpHeaders.cs @@ -5,13 +5,13 @@ using Elsa.Http.Serialization; namespace Elsa.Http.Models; /// -/// Represents the headers of an HTTP request. +/// Represents the headers of an HTTP message. /// -[JsonConverter(typeof(HttpRequestHeadersConverter))] -public class HttpRequestHeaders : Dictionary +[JsonConverter(typeof(HttpHeadersConverter))] +public class HttpHeaders : Dictionary { /// - /// Gets the content type of the request. + /// Gets the content type. /// public string? ContentType => this.GetValue("content-type")?[0]; } \ No newline at end of file diff --git a/src/modules/Elsa.Http/Models/HttpResponseHeaders.cs b/src/modules/Elsa.Http/Models/HttpResponseHeaders.cs deleted file mode 100644 index d93a43b36..000000000 --- a/src/modules/Elsa.Http/Models/HttpResponseHeaders.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Elsa.Extensions; - -namespace Elsa.Http.Models; - -/// -/// Represents the headers of an HTTP response. -/// -public class HttpResponseHeaders : Dictionary -{ - /// - /// Gets the content type of the response. - /// - public string? ContentType => this.GetValue("content-type")?[0]; -} \ No newline at end of file diff --git a/src/modules/Elsa.Http/Scripting/JavaScript/HttpJavaScriptHandler.cs b/src/modules/Elsa.Http/Scripting/JavaScript/HttpJavaScriptHandler.cs index 16bb014d3..c0565fac3 100644 --- a/src/modules/Elsa.Http/Scripting/JavaScript/HttpJavaScriptHandler.cs +++ b/src/modules/Elsa.Http/Scripting/JavaScript/HttpJavaScriptHandler.cs @@ -29,7 +29,7 @@ public class HttpJavaScriptHandler : INotificationHandler, Task INotificationHandler.HandleAsync(EvaluatingJavaScript notification, CancellationToken cancellationToken) { var engine = notification.Engine; - engine.RegisterType(); + engine.RegisterType(); engine.RegisterType(); var activityExecutionContext = notification.Context; @@ -62,7 +62,7 @@ public class HttpJavaScriptHandler : INotificationHandler, private IEnumerable GetTypeDefinitions(TypeDefinitionContext context) { - yield return _typeDescriber.DescribeType(typeof(HttpRequestHeaders)); + yield return _typeDescriber.DescribeType(typeof(HttpHeaders)); yield return _typeDescriber.DescribeType(typeof(Downloadable)); } diff --git a/src/modules/Elsa.Http/Serialization/HttpRequestHeadersConverter.cs b/src/modules/Elsa.Http/Serialization/HttpHeadersConverter.cs similarity index 79% rename from src/modules/Elsa.Http/Serialization/HttpRequestHeadersConverter.cs rename to src/modules/Elsa.Http/Serialization/HttpHeadersConverter.cs index 840b2d6c4..ece243fd7 100644 --- a/src/modules/Elsa.Http/Serialization/HttpRequestHeadersConverter.cs +++ b/src/modules/Elsa.Http/Serialization/HttpHeadersConverter.cs @@ -4,18 +4,16 @@ using Elsa.Http.Models; namespace Elsa.Http.Serialization; -/// -/// A custom JSON converter for that supports both single and multiple values. -/// -public class HttpRequestHeadersConverter : JsonConverter +/// A custom JSON converter for HttpHeaders that supports both single and multiple values. +public class HttpHeadersConverter : JsonConverter { /// - public override HttpRequestHeaders Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override HttpHeaders Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException("Expected StartObject token"); - var headers = new HttpRequestHeaders(); + var headers = new HttpHeaders(); while (reader.Read()) { @@ -53,7 +51,7 @@ public class HttpRequestHeadersConverter : JsonConverter } /// - public override void Write(Utf8JsonWriter writer, HttpRequestHeaders value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, HttpHeaders value, JsonSerializerOptions options) { writer.WriteStartObject(); diff --git a/src/modules/Elsa.Http/Serialization/HttpStatusCodeCaseForWorkflowInstanceConverter.cs b/src/modules/Elsa.Http/Serialization/HttpStatusCodeCaseForWorkflowInstanceConverter.cs index 8ad36ada0..d11e4e5b6 100644 --- a/src/modules/Elsa.Http/Serialization/HttpStatusCodeCaseForWorkflowInstanceConverter.cs +++ b/src/modules/Elsa.Http/Serialization/HttpStatusCodeCaseForWorkflowInstanceConverter.cs @@ -4,9 +4,7 @@ using Elsa.Http.Models; namespace Elsa.Http.Serialization; -/// /// A custom JSON converter for objects when serializing workflow states. -/// public class HttpStatusCodeCaseForWorkflowInstanceConverter : JsonConverter { /// diff --git a/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/DocumentApprovalWorkflow.cs b/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/DocumentApprovalWorkflow.cs index 87a1d84c4..d00f4a28b 100644 --- a/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/DocumentApprovalWorkflow.cs +++ b/src/samples/aspnet/Elsa.Samples.AspNet.DocumentApproval/DocumentApprovalWorkflow.cs @@ -1,4 +1,4 @@ -using System.Dynamic; +using System.Dynamic; using System.Net; using System.Net.Mime; using Elsa.Expressions.Models; @@ -39,7 +39,7 @@ namespace Elsa.Samples.AspNet.DocumentApproval Content = new("

Request for Approval Sent

Your document has been received and will be reviewed shortly.

"), ContentType = new(MediaTypeNames.Text.Html), StatusCode = new(HttpStatusCode.OK), - ResponseHeaders = new(new HttpResponseHeaders { ["X-Powered-By"] = new[] { "Elsa 3.0" } }) + ResponseHeaders = new(new HttpHeaders { ["X-Powered-By"] = new[] { "Elsa 3.0" } }) }, new Fork {