public HttpResponseMessage Send(HttpRequestMessage request) { PrepareRequest(ref request); var async = new HttpStageProcessingAsyncState(GetPipeline(), request) { ForceSynchronous = true }; var result = new HttpStageProcessingAsyncResult(async, null, null); var xyz = HttpStageProcessingAsyncResult.End(result, true); if (!result.CompletedSynchronously) { throw new InvalidOperationException("didn't complete synchronously: " + result + " " + xyz.Response); } return xyz.Response; }
HttpStageProcessingAsyncResult BeginSendCore(HttpRequestMessage request, AsyncCallback callback, object state) { var async = new HttpStageProcessingAsyncState(GetPipeline(), request); var stage = new HttpStageProcessingAsyncResult(async, callback, state); return stage; }