I have a WebAPI service, and I want it to send an http request to itself. I'd like to confirm what the most appropriate way of doing this looks like. (Normally, I would just instantiate another instance of the target controller or refactor the code behind an interface and then make request that way, but for various reasons I do not want to use that method.)
Is the code below the most appropriate way to make the http request to a different controller within the same service?
using (HttpClient client = new HttpClient())
{
var httpRequest = new HttpRequestMessage("GET", "https://localhost/SomeOtherController");
return await client.SendAsync(httpRequest);
}