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:
@@ -43,10 +43,7 @@ public class InvokeRecActionViewCommandHandler(
|
||||
.ToHttpRequestMessage(action.EndpointUri);
|
||||
|
||||
if (action.Body is not null)
|
||||
{
|
||||
using var reqBody = new StringContent(action.Body);
|
||||
httpReq.Content = reqBody;
|
||||
}
|
||||
httpReq.Content = new StringContent(action.Body);
|
||||
|
||||
if (action.Headers is not null)
|
||||
foreach (var header in action.Headers)
|
||||
|
||||
Reference in New Issue
Block a user