diff --git a/src/ReC.Application/Common/HttpExtensions.cs b/src/ReC.Application/Common/HttpExtensions.cs new file mode 100644 index 0000000..b24f6b4 --- /dev/null +++ b/src/ReC.Application/Common/HttpExtensions.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ReC.Application.Common; + +public static class HttpExtensions +{ +} diff --git a/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs b/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs index bd56113..431490c 100644 --- a/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs +++ b/src/ReC.Application/RecActions/Commands/InvokeRecActionCommand.cs @@ -1,8 +1,6 @@ using MediatR; using Microsoft.Extensions.Logging; using ReC.Application.Common.Dto; -using System; -using static System.Net.WebRequestMethods; namespace ReC.Application.RecActions.Commands; @@ -25,7 +23,7 @@ public class InvokeRecActionCommandHandler( { public async Task Handle(InvokeRecActionCommand request, CancellationToken cancel) { - var http = clientFactory.CreateClient(); + using var http = clientFactory.CreateClient(); if (request.RestType is null) { @@ -38,9 +36,9 @@ public class InvokeRecActionCommandHandler( } var method = new HttpMethod(request.RestType.ToUpper()); - var msg = new HttpRequestMessage(method, request.EndpointUri); + using var msg = new HttpRequestMessage(method, request.EndpointUri); - var response = await http.SendAsync(msg, cancel); + using var response = await http.SendAsync(msg, cancel); var body = await response.Content.ReadAsStringAsync(cancel); var headers = response.Headers.ToDictionary(); }