In ASP.NET Core 3, what is the best way to call a Web API that I trust from my site (server-side) and pass through its response on my site?
For example, I have a controller action such as this, and I want to just get whatever HTTP status and JSON data, etc. comes out of the call.
[HttpGet]
public async Task<IActionResult> Get(int id){
string url = "https://...";
return await httpClient.GetAsync(url); // not quite right...
}
However, GetAsync returns an HttpResponseMessage. Should I convert this to a IActionResult? If so, how can I do so without resorting to System.Web.Http.ResponseMessageResult from Microsoft.AspNetCore.WebApiCompatShim (since I don't need compatibility with older web API conventions)? I feel like there's a simpler approach I'm missing.
(I'd like the method here with the least overhead, of course, since I'm not seeking to transform or augment the response. No deserialization, especially.)