Skip to content

Instantly share code, notes, and snippets.

View oliverw's full-sized avatar
🎯
Focusing

Oliver Weichhold oliverw

🎯
Focusing
  • Berlin
  • 01:36 (UTC +02:00)
View GitHub Profile
@anaisbetts
anaisbetts / HttpWithCancellation.cs
Created October 22, 2013 23:41
Rx-based HTTP requests that disconnect early as soon as possible when asked
/// <summary>
/// Sends an HTTP request and attempts to cancel the request as soon as
/// possible if requested to do so.
/// </summary>
/// <param name="request">The HTTP request to make</param>
/// <param name="shouldFetchContent">If given, this predicate allows you
/// to cancel the request based on the returned headers. Return false to
/// cancel reading the body</param>>
/// <returns>A tuple of the HTTP Response and the full message
/// contents.</returns>