Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 3.0.1 #4759

Merged
merged 24 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8002f20
Stash
sfmskywalker Jan 3, 2024
f89641d
Update packages.yml for version 3.0.1
sfmskywalker Jan 3, 2024
4c783ec
Update git branch for commit verification in workflow
sfmskywalker Jan 3, 2024
7f1b5be
Update Elsa.Studio package versions
sfmskywalker Jan 4, 2024
853355b
Add background execution to activities and update HTTP requests
sfmskywalker Jan 5, 2024
2b6294b
Add background execution handling to activity context
sfmskywalker Jan 5, 2024
a950a6d
Add scheduling function for background activities
sfmskywalker Jan 5, 2024
7c632a5
Refactor HTTP request handling by removing SendHttpRequestTask
sfmskywalker Jan 6, 2024
6baaa2a
Update GitHub Actions workflow for new release
sfmskywalker Jan 6, 2024
dc519af
Update branch verification in GitHub workflow
sfmskywalker Jan 6, 2024
c750686
New options to control retry logic for transient failures (#4750)
NightWuYo Jan 6, 2024
53bd1f9
Add IExecuteWorkflowApi interface and refine retry policy configuration
sfmskywalker Jan 6, 2024
652a617
Add option for synchronous broadcast in WorkflowInbox
sfmskywalker Jan 6, 2024
3b48636
Update FastEndpoints packages to version 5.21.2
sfmskywalker Jan 6, 2024
91ac5e8
Merge branch '3.0.1' into v3.0.1
sfmskywalker Jan 6, 2024
70530aa
Add decimal check in PolymorphicObjectConverter
sfmskywalker Jan 6, 2024
6dee8ee
Refactor Dapper workflow and update migrations
sfmskywalker Jan 6, 2024
c135e1e
Update workflow to use main branch and version 3.1.0
sfmskywalker Jan 6, 2024
c3741fb
Remove unnecessary Elsa Server activities
sfmskywalker Jan 6, 2024
530d6a7
Update package workflow to reference v3.0.1
sfmskywalker Jan 6, 2024
6a11d4e
Update Elsa.Studio packages to version 3.0.1-preview.196
sfmskywalker Jan 6, 2024
fff67f4
Update Elsa.Studio package versions
sfmskywalker Jan 6, 2024
aac94d5
Remove unused Workflow models and simplify AddStorageDriver method
sfmskywalker Jan 6, 2024
30c6479
Remove unnecessary dependencies in DefaultBackgroundActivityInvoker
sfmskywalker Jan 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor HTTP request handling by removing SendHttpRequestTask
SendHttpRequestTask was deleted and its functionality was merged into SendHttpRequestBase. This consolidation led to the addition of StatusCode and ResponseHeaders output fields in SendHttpRequestBase. Another change includes the update in FlowSendHttpRequest to indicate that it's no longer deprecated. Also, HttpHeaders class was extended to accommodate HttpResponseHeaders objects. The consolidation was done to streamline the HTTP request handling process.
  • Loading branch information
sfmskywalker committed Jan 6, 2024
commit 7c632a5b5529df2d61b3a1e8187dd069ad09323f
5 changes: 1 addition & 4 deletions src/modules/Elsa.Http/Activities/FlowSendHttpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ namespace Elsa.Http;
/// <summary>
/// Send an HTTP request.
/// </summary>
[Activity("Elsa", "HTTP", "Send an HTTP request. This activity yis deprecated in favor of the SendHttpRequestTask activity", DisplayName = "HTTP Request (flow) [Deprecated] ", Kind = ActivityKind.Task)]
[Obsolete("Use SendHttpRequestTask instead.")]
[Activity("Elsa", "HTTP", "Send an HTTP request.", DisplayName = "HTTP Request (flow)", Kind = ActivityKind.Task)]
public class FlowSendHttpRequest : SendHttpRequestBase, IActivityPropertyDefaultValueProvider
{
/// <inheritdoc />
Expand Down Expand Up @@ -44,8 +43,6 @@ protected override async ValueTask HandleResponseAsync(ActivityExecutionContext
outcomes.Add(outcome);

outcomes.Add("Done");

context.JournalData["StatusCode"] = statusCode;
await context.CompleteActivityWithOutcomesAsync(outcomes.ToArray());
}

Expand Down
17 changes: 17 additions & 0 deletions src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,24 @@ protected SendHttpRequestBase(string? source = default, int? line = default) : b
)]
public Input<HttpHeaders?> RequestHeaders { get; set; } = new(new HttpHeaders());

/// <summary>
/// The HTTP response status code
/// </summary>
[Output(Description = "The HTTP response status code")]
public Output<int> StatusCode { get; set; } = default!;

/// <summary>
/// The parsed content, if any.
/// </summary>
[Output(Description = "The parsed content, if any.")]
public Output<object?> ParsedContent { get; set; } = default!;

/// <summary>
/// The response headers that were received.
/// </summary>
[Output(Description = "The response headers that were received.")]
public Output<HttpHeaders?> ResponseHeaders { get; set; } = default!;

/// <inheritdoc />
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
{
Expand Down Expand Up @@ -115,8 +127,13 @@ private async Task TrySendAsync(ActivityExecutionContext context)
{
var response = await httpClient.SendAsync(request, cancellationToken);
var parsedContent = await ParseContentAsync(context, response.Content);
var statusCode = (int)response.StatusCode;
var responseHeaders = new HttpHeaders(response.Headers);

context.Set(Result, response);
context.Set(ParsedContent, parsedContent);
context.Set(StatusCode, statusCode);
context.Set(ResponseHeaders, responseHeaders);

await HandleResponseAsync(context, response);
}
Expand Down
220 changes: 0 additions & 220 deletions src/modules/Elsa.Http/Activities/SendHttpRequestTask.cs

This file was deleted.

20 changes: 20 additions & 0 deletions src/modules/Elsa.Http/Models/HttpHeaders.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Net.Http.Headers;
using System.Text.Json.Serialization;
using Elsa.Extensions;
using Elsa.Http.Serialization;
Expand All @@ -10,6 +11,25 @@ namespace Elsa.Http.Models;
[JsonConverter(typeof(HttpHeadersConverter))]
public class HttpHeaders : Dictionary<string, string[]>
{
/// <inheritdoc />
public HttpHeaders()
{
}

/// <inheritdoc />
public HttpHeaders(IDictionary<string, string[]> source)
{
foreach (var item in source)
Add(item.Key, item.Value);
}

/// <inheritdoc />
public HttpHeaders(HttpResponseHeaders source)
{
foreach (var item in source)
Add(item.Key, item.Value.ToArray());
}

/// <summary>
/// Gets the content type.
/// </summary>
Expand Down