예제 #1
0
        private UploadResponse FinishUpload()
        {
            var finishUri = GetFinishUriForThreadedUploads();
            var client    = GetHttpClient();

            var requestMessage = new HttpRequestMessage(HttpMethod.Get, finishUri);

            requestMessage.Headers.Add("Accept", "application/json");
            requestMessage.AddDefaultHeaders(Client);

            var response = RequestExecutor.Send(client, requestMessage, HttpCompletionOption.ResponseContentRead);

            return(GetUploadResponse(response, HashProvider.GetComputedHashAsString()));
        }
예제 #2
0
        private void ExecuteChunkUploadMessage(HttpRequestMessage requestMessage, CancellationToken cancellationToken)
        {
            TryPause();

            requestMessage.AddDefaultHeaders(Client);

            var client = GetHttpClient();

            using (var responseMessage = RequestExecutor.Send(client, requestMessage, HttpCompletionOption.ResponseContentRead))
            {
                if (Configuration.IsNetCore)
                {
                    progressReporter.ReportProgress(requestMessage.Content.Headers.ContentLength.GetValueOrDefault());
                }
                string responseContent = responseMessage.Content.ReadAsStringAsync().WaitForTask();
                ValidateChunkResponse(responseMessage, responseContent);
            }
        }