Released 02 June 2025.
- Fixed base URL not applied correctly when calling a relative URL on Unix (thanks to F2!).
Released 05 June 2024.
- Fixed cases where calling
AsStream()would fail with an error (thanks to Jericho!).
Released 24 May 2024.
- Added support for response streaming using the
completeWhenrequest option (thanks to Jericho!). - Updated dependencies to fix a vulnerability warning.
Released 14 March 2023.
- Added cancellation token to responses (thanks to Jericho!).
- Added request coordinator property to
IClientinterface (thanks to Jericho!). - Added README to NuGet package.
- Updated dependencies.
- Fixed some async operations not using the cancellation token (thanks to Jericho!).
Released 07 October 2022.
- Added .NET 5.0+ as a target framework. (It was already supported, this just makes that clearer.)
- Added constructor which takes an
HttpClientwithout a base URI (thanks to TimothyMakkison!). - Added fluent
request.WithFilterandWithoutFiltermethods (thanks to Jericho!). - Fixed
resourceparameters for methods likeGetAsyncmarked non-nullable. - Internal optimizations.
Released 22 June 2022.
- Bumped min .NET Framework version from 4.5 to 4.5.2.
- Updated to Json.Net 13.0.1.
- Fixed IntelliSense docs for
With/SetOptions(thanks to Jericho!).
Released 11 March 2021.
- Added support for chained retry policies (thanks to Jericho!).
- Fixed
WithBody(null)no longer allowed in 4.0.
Released 13 May 2020.
- Added nullable reference type annotations.
- Added support for creating a client without a base URL.
- Improved documentation.
- Updated dependencies in .NET Standard 1.3 package.
- Fixed
FormUrlEncodedbody created from a dictionary being restricted to URL length and not allowing null. - Breaking changes:
-
Null arguments like
request.WithArgument("x", null)are now ignored instead of sending a blank value. You can use the previous behaviour usingclient.SetOptions(ignoreNullArguments: false). -
Simplified constructors to make usage more intuitive.
-
Removed deprecated code:
old code migration client.SetHttpErrorAsExceptionuse client.SetOptions.request.WithBodyContentuse request.WithBody.some request.WithBodymodel overloadsuse request.WithBody(builder => builder.Model(...)).request.WithHttpErrorAsExceptionuse request.WithOptions.BsonFormatteruse a BSON MediaTypeFormatterpackage like WebApiContrib.Core.Formatter.Bson.
-
Released 19 July 2019.
request.WithBodynow allowsHttpContentinput.bodyBuilder.FormUrlEncodednow has an overload for dictionary input.- Fixed form-URL-encoded body helper enforcing URL length limits.
Released 27 April 2019.
- Added support for reading responses into
JToken,JObject,JArray, ordynamic. - Added fluent HTTP body builders, and deprecated some older body methods to simplify usage.
- Added
IsSuccessStatusCodeto response. - Fixed default web proxy not being used.
- Updated dependencies.
Released 18 April 2018.
- Added options to finetune behavior (see
client.SetOptionsandrequest.WithOptions). - The base URL now behaves more intuitively in many cases.
Request.WithArgumentsnow omits null argument values by default.Request.WithArgumentsnow also accepts key/value pairs.- Fixed cookie headers not being set.
- Fixed error when passing an object with an indexer property to
WithArguments. - Fixed
WithArgumentschanging the URL incorrectly when it has a #fragment. - Deprecated
client.SetHttpErrorAsExceptionandrequest.WithHttpErrorAsException(useclient.SetOptionsandrequest.WithOptionsinstead). - Compatibility changes:
- Added .NET Framework 4.5 (previously 4.5.2).
- Simplified dependencies in .NET Framework 4.5+ and .NET Standard 2.0+.
Possible impacting changes:
- The base URL is no longer truncated in some cases. For example, a base URL
https://example.org/index.phpwith resourceapinow resolves tohttps://example.org/index.php/apiinstead ofhttps://example.org/api.
Released 19 September 2017.
- Added option to set default behaviour for all requests.
For example, when using an API with URL-based authentication, you can doclient.AddDefault(request => request.WithArgument("token", "..."))to add that argument to all later requests. - Added support for retrying timed-out requests.
- Deprecated
BsonFormatter.
This uses Json.NET'sBsonReader, which is now deprecated. The format isn't used often enough to justify adding a new dependency. If you use it, you can switch to another BSON media type formatter or copy it from the FluentHttpClient code before it's removed. - Fixed error when retrying a request with
POSTcontent. - Fixed
IRetryConfig.MaxRetriescounting the initial request as a retry.
For example,maxRetries: 1never retried. This value now sets the maximum number of retries after the initial request.
Released 08 February 2017.
- New features:
- Added built-in retry support.
- Added methods to set authentication headers (with wrappers for basic auth and OAuth bearer tokens).
- Added support for cancellation tokens.
- Added support for disabling HTTP-errors-as-exceptions per-request or per-client.
- Added support for fault tolerance using
IRequestCoordinator. - Added support for
IWebProxy. - Added
client.PatchAsync. - Added
client.SetUserAgentto override defaultUser-Agentheader.
- Breaking changes:
- Replaced
response.AsList<T>withreponse.AsArray<T>. - Removed
JsonNetFormatter(deprecated since 2.1, now built-in). - Revamped
IResponseto make it easier to read response data. - Simplified
IClientandIRequestby moving some methods into extension methods. - Simplified
IHttpFilterby removing the message arguments (already accessible viaIRequestandIResponse).
- Replaced
- Improvements:
- Fixed the underlying
HttpClientbeing disposed when it isn't owned by the fluent client. - Fixed
client.Filtersnot added to the interface. - Fixed
client.Filters.Remove<T>()only removing the first match. - Fixed unintuitive behaviour when the base URL doesn't end in a slash.
- Fixed the underlying
- Relicensed from CC-BY 3.0 to more permissive MIT license.
Released 12 December 2016.
- Migrated to .NET Standard 1.3 + .NET Core to improve crossplatform support.
Released 30 June 2016.
- Updated to latest version of Json.NET.
- Merged formatters library into client.
- Prepared for migration to .NET Core.
Released 08 May 2016.
- Migrated to PCL for cross-platform compatibility.
- Removed support for JSONP.
(This isn't needed since a JSONP API most likely supports JSON, and removing it eliminates a dependency on non-PCL code.) - Deprecated
JsonNetFormatter.
(The underlying HttpClient now uses Json.NET by default.)
Released 28 April 2016.
- Replace
IFactorywith a new extensibility model usingIHttpFilter.
(This enables simpler and more powerful extensibility without exposing implementation details. For example, error handling can now read the underlying HTTP response directly without temporarily changing theRaiseErrorsflag.) - Removed request cloning (no longer needed).
- Updated to the latest version of HttpClient and Json.NET.
Released 28 October 2015.
- The client is now
IDisposable.
Released 30 October 2013.
- Updated to latest versions of HttpClient and Json.NET.
Released 28 August 2013.
- Added request cloning to support use cases like batch queries.
- Added UTF-8 as a supported encoding by default.
Released 23 May 2012.
- Initial client release:
- Wrapped HttpClient with a fluent interface.
- Added user-agent and accept headers by default.
- Added
ApiExceptionthrown when server returns a non-success error code. - Added
request.WithArgumentto format URL arguments from an anonymous object or key + value. - Added
response.As<T>(),.AsList<T>(),.AsByteArray(),AsString(), andAsStream()to parse the response body. - Added
response.Wait()to simplify synchronous use. - Added support for customising the message handler.
- Added
IFactoryfor extensibility.
- Initial formatters release:
- Added base
MediaTypeFormatterclass to simplify implementations. - Added
MediaTypeFormatterimplementations for BSON, JSON, and JSONP using Json.NET. - Added
MediaTypeFormatterfor plaintext (serialisation only).
- Added base
- Added unit tests.