diff --git a/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs b/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs index 60ee956..cb3a936 100644 --- a/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs +++ b/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs @@ -1,7 +1,10 @@ using MediatR; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using ReC.Application.Common; using ReC.Application.Common.Dto; +using ReC.Application.OutResults.Commands; +using System.Text.Json; namespace ReC.Application.RecActions.Commands; @@ -18,7 +21,9 @@ public static class InvokeRecActionCommandExtensions } public class InvokeRecActionCommandHandler( - IHttpClientFactory clientFactory, + ISender sender, + IHttpClientFactory clientFactory, + IConfiguration? config = null, ILogger? logger = null ) : IRequestHandler { @@ -53,5 +58,13 @@ public class InvokeRecActionCommandHandler( using var response = await http.SendAsync(httpReq, cancel); var resBody = await response.Content.ReadAsStringAsync(cancel); var resHeaders = response.Headers.ToDictionary(); + + await sender.Send(new CreateOutResCommand + { + ActionId = (long) request.ActionId!, + Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }), + Body = resBody, + AddedWho = config?["AddedWho"] + }, cancel); } } \ No newline at end of file