Skip to content

Flurl.Http 2.0

Compare
Choose a tag to compare
@tmenier tmenier released this 01 Oct 14:38
· 535 commits to master since this release

This is big. See #205 for details and motivations.

New Features

  • Aggressive reuse of HttpClient (single instance per host) by default when not managing FlurlClient explicitly (#144)
  • IFlurlClientFactory and FlurlClientFactoryBase allow for easily customizing caching/reuse strategy
  • Better IoC support with alternative IFlurlClientFactory implementation (#226)
  • ConnectionLeaseTimeout setting to deal with potential DNS issue (#222)
  • New FlurlRequest object implicitly created instead of FlurlClient in fluent expressions
  • Headers available at both request and client level (#157)
  • URL builder methods and request configuration methods (WithHeaders, etc) can be called in any order in fluent expressions (#211)
  • FlurlClient.Request method for fluently building a request off a client (#211)
  • FlurlClient.BaseUrl property to (optionally) build all requests off of (#211)
  • WithTimeout specific to a single request
  • Settings available on FlurlRequest, FlurlClient, HttpTest, and FlurlHttp (global) level, each inheriting defaults from a level up (#205 (comment))
  • Ability to fluently tweak request from BeforeCall / BeforeCallAsync (#213)
  • More robust FlurlHttpException.Message (#217)
  • New HttpTest assertions: WithHeader / WithoutHeader (#223)

Breaking Changes from 1.x

  • All fluent extension methods on IFlurlClient moved to IFlurRequest, and all fluent extension methods on Url and string that previously returned IFlurlClient now return IFlurlRequest (Typical usages shouldn't break, but custom extensions should be updated to follow this new pattern)
  • FlurlClient.Url removed (superseded by FlurlRequest.Url)
  • FlurlClient.WithUrl removed (superseded by FlurlClient.Request)
  • FlurlClient.ConfigureClient renamed to FlurlClient.Configure
  • ConfigureClient extensions on IFlurlRequest, Url, and string replaced by ConfigureRequest
  • Url.ConfigureHttpClient removed
  • FlurlHttpSettings.DefaultTimeout replaced by FlurlHttpSettings.Timeout (like other settings, it's the "default" when defined at client or global level)
  • FlurlClient.Clone removed
  • Several FlurlClient constructors removed
  • FlurlHttpSettings.Clone removed
  • FlurlHttpSettings.AutoDispose removed (auto-dispose behavior no longer supported because short-lived clients is not a recommended practice)
  • IHttpClientFactory.CreateClient no longer takes a Url arg (more relevant to IFlurlClientFactory.Get, where caching strategy should be defined)
  • HttpCall.Url removed (superseded by HttpCall.FlurlRequest.Url
  • HttpCall.Settings removed (superseded by HttpCall.FlurlRequest.Settings
  • WithHeaders(object) converts underscores in property names to hyphens in header names by default (#44)

Bug Fixes

  • Cookies work correctly when HttpClientHandler is wrapped in DelegatingHandler (#202)
  • Reading response cookies is skipped when request fails (#208)