private async Task<HttpResponseMessage> SendAsync(HttpMethod method, Action<IHttpRequestMessageConfigurator> configure) { var configurator = new HttpRequestMessageConfigurator(); configurator.Method(method); configurator.BaseAddress(_http.BaseAddress); configure(configurator); var request = configurator.Build(); #if MGP_LATER var response = await _http.SendAsync(request).ConfigureAwait(false); await response.EnsureSuccessStatusCode(true).ConfigureAwait(false); return response; #else var task = _http.SendAsync(request); var response = task.Result; response.EnsureSuccessStatusCode(true).Wait(); return response; #endif }
private async Task <HttpResponseMessage> SendAsync(HttpMethod method, Action <IHttpRequestMessageConfigurator> configure) { var configurator = new HttpRequestMessageConfigurator(); configurator.Method(method); configurator.BaseAddress(_http.BaseAddress); configure(configurator); var request = configurator.Build(); #if MGP_LATER var response = await _http.SendAsync(request).ConfigureAwait(false); await response.EnsureSuccessStatusCode(true).ConfigureAwait(false); return(response); #else var task = _http.SendAsync(request); var response = task.Result; response.EnsureSuccessStatusCode(true).Wait(); return(response); #endif }