Flurl.Http 2.0
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
andFlurlClientFactoryBase
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 ofFlurlClient
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 requestSettings
available onFlurlRequest
,FlurlClient
,HttpTest
, andFlurlHttp
(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 toIFlurRequest
, and all fluent extension methods onUrl
andstring
that previously returnedIFlurlClient
now returnIFlurlRequest
(Typical usages shouldn't break, but custom extensions should be updated to follow this new pattern) FlurlClient.Url
removed (superseded byFlurlRequest.Url
)FlurlClient.WithUrl
removed (superseded byFlurlClient.Request
)FlurlClient.ConfigureClient
renamed toFlurlClient.Configure
ConfigureClient
extensions onIFlurlRequest
,Url
, andstring
replaced byConfigureRequest
Url.ConfigureHttpClient
removedFlurlHttpSettings.DefaultTimeout
replaced byFlurlHttpSettings.Timeout
(like other settings, it's the "default" when defined at client or global level)FlurlClient.Clone
removed- Several
FlurlClient
constructors removed FlurlHttpSettings.Clone
removedFlurlHttpSettings.AutoDispose
removed (auto-dispose behavior no longer supported because short-lived clients is not a recommended practice)IHttpClientFactory.CreateClient
no longer takes aUrl
arg (more relevant toIFlurlClientFactory.Get
, where caching strategy should be defined)HttpCall.Url
removed (superseded byHttpCall.FlurlRequest.Url
HttpCall.Settings
removed (superseded byHttpCall.FlurlRequest.Settings
WithHeaders(object)
converts underscores in property names to hyphens in header names by default (#44)