Refactor HTTP request handling in InvokeRecActionCommand
Replaced the `reqMsg` variable with `httpReq` to simplify the creation and usage of `HttpRequestMessage`. The `request.RestType` is now used directly to create `httpReq`, which is passed to `http.SendAsync`. This change reduces redundancy and improves code clarity.
This commit is contained in:
parent
a84b5531b7
commit
a66a70fab3
@ -36,11 +36,11 @@ public class InvokeRecActionCommandHandler(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var reqMsg = request.RestType
|
using var httpReq = request.RestType
|
||||||
.ToHttpMethod()
|
.ToHttpMethod()
|
||||||
.ToHttpRequestMessage(request.EndpointUri);
|
.ToHttpRequestMessage(request.EndpointUri);
|
||||||
|
|
||||||
using var response = await http.SendAsync(reqMsg, cancel);
|
using var response = await http.SendAsync(httpReq, cancel);
|
||||||
var body = await response.Content.ReadAsStringAsync(cancel);
|
var body = await response.Content.ReadAsStringAsync(cancel);
|
||||||
var headers = response.Headers.ToDictionary();
|
var headers = response.Headers.ToDictionary();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user