Releases: tmenier/Flurl
Releases · tmenier/Flurl
Flurl.Http 3.0
New Features
FlurlResponse
introduced, primarily to enable inspecting response and deserializing body in separate steps. (#354)- Major overhaul of cookie functionality. (#506)
- Overhaul of redirect handling. (#500)
- Tests can be set up to return different fake responses depending on the URL or any other request conditions. (#481)
HttpTest.ForCallsTo(...).AllowRealHttp()
for allowing real calls to be made in a test for specific URLs or any other request conditions. (#225)- New/more complete set of test assertions for headers and cookies. (#508)
- All extension methods on
Flurl.Url
andstring
are now also available onSystem.Uri
. (#489) - Providing a body for
PostAsync
,PutAsync
, andPatchAsync
now optional. (#515)
Breaking Changes from 2.x
Making HTTP calls
- Fluent methods that previously returned
HttpResponseMessage
(suchGetAsync
,PostAsync
, etc) now returnFlurlResponse
. If you're usingGetJsonAsync
or chainingReceiveXXX
methods, this shouldn't break anything. (#354) HttpCall
is nowFlurlCall
, and several properties ofFlurlCall
andFlurlHttpException
were moved or renamed. (#488)- Slightly different rules on when a redirect causes the verb to change to GET. (Never on 300, always on 303. #500)
- Minor changes to
CapturedStringContent
constructors. (#452)
Headers
- New collection type for
IFlurlRequest.Headers
andIFlurlClient.Headers
. (#541) HttpRequestMessage.GetHeaderValue
andHttpResponseMessage.GetHeaderValue
extension methods removed. (#553)- For multipart requests,
Content-Type
header for text parts allowed but not defaulted. (#452) Cookie
request header andSet-Cookie
response headers are always visible inHeaders
collection of request and response. (#506)
Cookies
CookiesEnabled
removed at all settings levels. (#506)Cookies
,WithCookie
andWithCookies
removed fromIFlurlClient
. UseCookieSession
instead. (#506)IFlurlRequest.Cookies
is now read-onlyIEnumerable<(string Name, string Value)>
. UseWithCookies
instead. (#506)
Testing
- When asserting a specific URL was called, it must be a full string match rather than "contains" or "starts with". Add a
*
wildcard to the beginning or end if you need partial match behavior. (#323) - When faking responses in tests, the last response in the queue becomes "sticky" rather than falling back to empty 200 responses. (#482)
HttpTest.ResponseQueue
public property has been removed. Underlying queue implementation changed significantly to support new features, and hopefully accessing it directly isn't needed. UseRespondWith
methods to build the queues.- Minor changes/enhancements to
HttpCallAssertion
. (#483)
Other
UseCookies
andAllowAutoRedirect
are disabled on the defaultHttpClientHandler
. Any custom factory-provided handler must do the same if Flurl's new cookie and redirect features are required. (#500 & #506)- Default
HttpClient
caching strategy based on host, scheme, and port, rather than just host. (#550) - Dropping support for older platforms. (#544)
Bug Fixes
Flurl 3.0
Flurl 3.0 contains a major rewrite of the URL building/parsing engine. It brings Flurl.Url
's feature set more in line with System.Uri
, while also addressing some of its quirks.
New Features
-
New
Url
properties (#440)Scheme
(read/write)UserInfo
(read/write)Host
(read/write)Port
(read/write)Authority
(read-only,UserInfo
+Host
+Port
)Root
(read-only,Scheme
+Authority
)PathSegments
(modifiable)IsRelative
(read-only)IsSecureScheme
(read-only, true for https or wss)
-
All URL-building extension methods currently on
string
now available onSystem.Uri
(#489) -
New fluent builder methods on
Flurl.Url
,System.Uri
, andstring
:RemovePathSegment()
(removes the last segment)RemovePath()
RemoveQuery()
Reset()
(restoresUrl
to its original state as constructed, NOT available onstring
)
-
Support for relative URLs (#407)
-
Parameterless constructor for
Url
(#518) -
New static utility method:
Url.ParsePathSegments(string)
(assumes entire string is the path portion of a URL)
Breaking Changes from 2.x
- New collection type for
Url.QueryParams
(#555) Url.Path
changed to be more in line with the formal definition. Previously it included everything (scheme, host, etc.) up to the query string. It now starts after the host/port, including the leading/
if present.Url.IsValid()
instance method was removed. It was confusing in the case of relative URLs since arguably any string could be considered a valid relative URL. Check theIsRelative
property instead. (StaticUrl.IsValid(string)
method is still available but, same a before, returns true only for valid absolute URLs.)- Dropping support for older platforms (#544)
Bug fixes:
Url.ToUri()
now works for relative URLs (#407)
Flurl.Http 2.4.2
- Updated package dependencies
Flurl 2.8.2
- Bug when decoding encoded
+
(#437)
Flurl.Http 2.4.1
- Multipart enhancement: allow alternate filename when adding file based on local path (#402)
- Improvements to downloaded file name inference (#404)
- Ensure FlurlClientFactory.Get is only called once when sending request (#374)
- BUGFIX: Plugged memory leak by disposing CancellationTokenSource (#395)
- BUGFIX: Prevent adding
Content-Type
header to multipart strings (#392) - BUGFIX: Missed a few cases when setting headers at request vs content level (#405)
Flurl 2.8.1
Flurl.Http 2.4.0
- Improved
ConnectionLeaseTimeout
implementation (#330) - Consistent disposal of
HttpResponseMessage
(#329) - Added
ConfigureClient
method toIFlurlClientFactory
(#356) - Added optional
CancelationToken
toDownloadFileAsync
(#360) - Added
WithRequestUrlEncoded
method toHttpCallAssertion
(#347) - Upgraded dependencies to latest Flurl & Newtonsoft
Flurl 2.8.0
Flurl.Http 2.3.2
- Header normalization and underscore logic used in core HTTP methods now also used in
HttpTest
header methods. (#331) - New extension methods
SetHeader
andGetHeaderValue
onHttpRequestMessage
andHttpResponseMessage
, allowing you to read/write headers without caring whether they're at the message level orHttpContent
level. (#331) - Use
AsyncLocal
to storeHttpTest.Current
in .NET Framework 4.6+ (#325) - BUGFIX: NullReferenceException when disposing
FlurlClient
constructed with existingHttpClient
. (#334) - BUGFIX: NullReferenceException when setting a content-type header but not actually sending content. (#313)
- BUGFIX: Calls made with
FlurlClient.HttpClient
result in null entries inHttpTest
's call log, causing errors. (#335) - Better comments on methods that serialize POCOs to JSON. (#312)
Flurl.Http 2.3.1
- First-class support for OPTIONS requests via
OptionsAsync
(#220) - Support building & testing on Mac and Linux (#290 & #286, thx @nlowe )
FlurlClient
constructor for wrapping an existingHttpClient
(#298)- Public constructor for
HttpCall
so that fakes can be easily created (#304) - BREAKING:
IFlurlClientFactory
implementsIDisposable
(#309) - BUGFIX: Don't overwrite content headers when set explicitly (#256)
- BUGFIX:
WithHeader
assert failed when header had space (#307)