in workshop/dotnet/Core.Utilities/Services/StocksService.cs [78:92]
private async Task<T> GetHttpResponse<T>(string requestUri)
{
HttpResponseMessage response = await _httpClient.GetAsync(requestUri);
if (!response.IsSuccessStatusCode)
{
string errorMessage = await response.Content.ReadAsStringAsync();
throw new HttpRequestException($"Request failed with status code: {response.StatusCode}, message: {errorMessage}");
}
T? data = await response.Content.ReadFromJsonAsync<T>();
Guard.Against.Null(data);
return data;
}