コード例 #1
0
		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

		}
コード例 #2
0
        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
        }