- using (var cts = CancellationTokenSource.CreateLinkedTokenSource (cancellation_token.Token, cancellationToken)) {
- cts.CancelAfter (timeout);
-
- var task = base.SendAsync (request, cts.Token);
- if (task == null)
- throw new InvalidOperationException ("Handler failed to return a value");
-
- var response = await task.ConfigureAwait (false);
- if (response == null)
- throw new InvalidOperationException ("Handler failed to return a response");
-
- //
- // Read the content when default HttpCompletionOption.ResponseContentRead is set
- //
- if (response.Content != null && (completionOption & HttpCompletionOption.ResponseHeadersRead) == 0) {
- await response.Content.LoadIntoBufferAsync (MaxResponseContentBufferSize).ConfigureAwait (false);
- }
+ var task = base.SendAsync (request, lcts.Token);
+ if (task == null)
+ throw new InvalidOperationException ("Handler failed to return a value");