Simplify StringContent assignment in HTTP request

Refactored code to assign StringContent directly to httpReq.Content without a using block. Disposal of StringContent is now handled by HttpRequestMessage, improving code clarity and resource management.
This commit is contained in:
2026-03-02 13:40:43 +01:00
parent 0a3761921d
commit 776813d05d

View File

@@ -43,10 +43,7 @@ public class InvokeRecActionViewCommandHandler(
.ToHttpRequestMessage(action.EndpointUri); .ToHttpRequestMessage(action.EndpointUri);
if (action.Body is not null) if (action.Body is not null)
{ httpReq.Content = new StringContent(action.Body);
using var reqBody = new StringContent(action.Body);
httpReq.Content = reqBody;
}
if (action.Headers is not null) if (action.Headers is not null)
foreach (var header in action.Headers) foreach (var header in action.Headers)