vNext (2024-X-X)
4.1.0 (2024-10-11)
- logger middleware: log pops individually for request/response
- http client factory: expose
Count
to know how many clients are registered - http client builder: auto register client into factory - can be omitted via
WithAutoRegisterFactory
(or.Build(skipAutoRegister: true)
) - service collection: configurable defaults on
services.AddFluentlyHttpClient
4.0.0 (2024-07-24)
- http client builder: configurable http version/policy via
WithVersion
,WithVersionPolicy
- http client builder: defaults to http version http2.0
- media type formatter: add
SystemTextJsonFormatter
.ConfigureFormatters(x => x.Default = x.Formatters.SystemTextJsonFormatter())
- logging: middleware loggings changed to compile-time logging
- request builder: uri interpolation regex compile-time
- deps: now target .net8
- http request: remove deprecated
FluentHttpRequest.Formatters
- models: change several options/context models to
record
's
3.9.6 (2024-06-11)
- util: add
QueryStringOptions.WithCollectionKeyFormatter
to be able to format keys only e.g. convert php like by appending[]
to the key - deps: update
Newtonsoft.Json
andMicrosoft.AspNet.WebApi.Client
fixing vulnerability warnings
3.9.5 (2024-03-22)
- util: add
QueryStringOptions.WithValueEncoder
to configure value encoding
3.9.4 (2023-07-07)
- headers: changed case insensitive for getting value
3.9.3 (2023-06-09)
- ci: migrate ci to github actions
- all: refactor global namespaces, global usings, filescoped namespaces etc...
3.9.2 (2022-09-26)
- util: fix adding querystring when collection is empty and is not first value to be added
3.9.1 (2021-01-06)
- http client builder: inherit
WithBaseUrlTrailingSlash
for sub clients
3.9.0 (2020-04-03)
- http client: allow empty baseUrl and not mandatory anymore
- http client:
HttpRequestMessage
are being disposed after sending - http client: add better support for file uploads (from: path, stream, bytes) e.g.
var multiForm = new MultipartFormDataContent
{
{ "hero", "Jaina" }
};
multiForm.AddFile("file", "./animal-mustache.jpg");
httpClient.CreateRequest("/api/sample/upload")
.AsPost()
.WithBodyContent(multiForm)
- header builder: add
WithBasicAuthentication
andWithBasicAuthentication(username, password)
(username:password
base64 encoded)
3.8.0 (2019-12-11)
- logger middleware: add condense mode which reduces clutter logs, add timings in responses. This might make a bit Timer logger a bit redundant, however log level thershold is not implemented. Unless its really needed removing
TimerMiddleware
from the pipeline it is suggested. - graphql: add
OperationName
- graphql: rename
GqlQuery
toGqlRequest
- csharp: initial nullability support
- logger middleware: when
ShouldLogDetailedRequest
is specified and had content null was not logging headers
- graphql: rename
GqlQuery
3.7.2 (2019-10-08)
- timer middleware: change non warning timing log to
Debug
instead ofInfo
(as it was too spammy especially when used withLoggerMiddleware
)
3.7.1 (2019-10-07)
- http client: attempt to fix issue
RequestTracker.push
internal Dictionary throws error on TryGet in certain scenarios (possibly concurrency)
3.7.0 (2019-09-09)
- logging: add headers to log message in
LoggerHttpMiddleware
3.6.0 (2019-09-04)
- headers: add several utility methods
ctor IDictionary<string, StringValues>
Add(string, StringValues)
Remove(string)
Contains(string)
- util: querystring options
WithValueFormatter
now sets alsoWithCollectionItemFormatter
- util: querystrings now ignore
private
,protected
and properties marked withIgnoreDataMemberAttribute
when using.WithQueryParams
or so
- util:
WithCollectionItemFormatter
deprecated in favor ofWithValueFormatter
as it will work for all query string values - collection items and props
3.5.0 (2019-09-03)
- util: add querystring option
WithValueFormatter
similar toWithCollectionItemFormatter
to format each value e.g. enum formatter
- util: query options deprecate
CollectionItemFormatter
andKeyFormatter
withWithCollectionItemFormatter
,WithKeyFormatter
instead of exposing func directly
3.4.0 (2019-08-26)
- http client builder: add
WithBaseUrlTrailingSlash
to control whether to include trailing slashes or not in base url
3.3.2 (2019-08-20)
- http request:
HttpRequestMessage.Properties
were not being flown toFluentHttpRequest
when using raw client - http client: fix issue when using
Send(HttpRequestMessage request)
(raw send) was creatingFluentHttpResponse
twice and the second which is returned was not including the.Items
3.3.1 (2019-06-12)
- http request: add
Items
fromFluentHttpRequestBuilder
which where missing when executing requests usingFluentHttpClient.RawHttpClient
3.3.0 (2019-05-29)
- http client: implicit conversion between
FluentHttpClient
andHttpClient
- http client: retain middleware logic when using
FluentHttpClient.RawHttpClient
- http client: add overload
Send(HttpRequestMessage request)
for better interoperability with the native when already havingHttpRequestMessage
- headers:
FluentHttpHeaders
now implementsIFluentHttpHeaderBuilder
, any extension methods added toIFluentHttpHeaderBuilder
will be available forFluentHttpHeaders
also, along withFluentHttpClientBuilder
andFluentHttpRequestBuilder
- middleware context:
FluentHttpMiddlewareClientContext
now includes formatters
- request:
FluentHttpRequest.Formatters
is now deprecated, this was added to be passed down to middleware. Now instead use theFluentHttpMiddlewareClientContext.Formatters
3.2.1 (2019-05-21)
- http client builder: fix formatters' merging when creating sub clients
3.2.0 (2019-05-07)
- request builder: when using
WithQueryParams
and configure options or configure options withWithQueryParamsOptions
will inherit from the previous configured options instead of the defaults
3.1.1 (2019-05-02)
- http client: client identifier inherits parent's e.g.
{parentId}.{id}
in the future this will be configurable
- request builder: fix request without path to build full uri with base correctly
3.1.0 (2019-04-25)
- request builder: now supports request without
Uri
to use onlyBaseUri
3.0.1 (2019-04-12)
- headers:
_data
waspublic
now is set toprivate
as intended
3.0.0 (2019-04-12)
Middleware has been reworked, its now much more efficient as it creates instances per middleware per client, instead of every request.
- middleware: middleware has been reworked, and now are much more efficient
- middleware: middleware now logs the identifier in source e.g.
FluentlyHttpClient.Middleware.sketch7.Timer
, given HttpClient identifier wassketch7
, so logs can be more fine controlled - headers: add
FluentHttpHeaders
sinceHttpHeaders
(and all implementations) cannot create instances of, and changed all implementations to use it instead ofDictionary<string, string>
- util: add several extensions when working with
HttpHeaders
- http request: now exposes the request builder
- http request: add request hash
FluentHttpRequest.GetHash
,FluentHttpRequestBuilder.WithRequestHashOptions
which can be used to build an id hash for the request - request builder: add
IFluentHttpMessageItems
whichFluentHttpRequestBuilder
,FluentHttpRequest
andFluentHttpResponse
implements, so items extension methods can target all - http client builder:
WithBaseUrl
now accepts optional boolreplace
which will append to the existing. Useful when creating sub client to inherit and continue adding to it - response caching middleware: implemented response caching middleware
UseResponseCaching
which the intention is not for performance improvements but more to proxy/mocking, as it copies responses and serve them if they were already requested. We also implemented remote caching which stores in database using EntityFramework see FluentlyHttpClient.Entity. It can also be extended to implement custom stores e.g. we have another which is for Microsoft Orleans (not published - yet)
- http client: fix
identifier
for sub client when usingCreateClient
was being replaced by the parent's instead of the one specified - http client builder: fix an issue when base url doesn't contain a trailing
/
in certain cases it will trim last value e.g. http://myapi.com/v1 would result in http://myapi.com
Even though breaking changes are quite a lot, most of them are more internal
- middleware:
FluentHttpRequestDelegate
has been removed in favor ofFluentHttpMiddlewareDelegate
- middleware:
IFluentHttpMiddlewareRunner
andFluentHttpMiddlewareRunner
has been reworked - middleware:
IFluentHttpMiddleware
changed fromInvoke(FluentHttpRequest)
toInvoke(FluentHttpMiddlewareContext)
- middleware: renamed
MiddlewareConfig
toFluentHttpMiddlewareConfig
for consistency - http client builder:
FluentHttpClientOptions
changedList<MiddlewareConfig> Middleware
toFluentHttpMiddlewareBuilder MiddlewareBuilder
- http client factory: removed
Add(FluentHttpClientOptions)
fromIFluentHttpClientFactory
and moved it as an extension method - exceptions: exceptions has been moved correctly to
FluentlyHttpClient
namespace - util: querystrings now defaults to camel casing instead of lower casing
- request builder:
FluentHttpRequestBuilder.WithQueryParams(object, bool)
has been removed - request builder: change headers from
Dictionary<string, string>
toFluentHttpHeaders
- http client builder: change options headers from
Dictionary<string, string>
toFluentHttpHeaders
See these changes in order to help you update an existing middleware to the new version (fear not, changes are minimal :)).
2.2.0 (2019-03-03)
- http client: now able to create a new http client from an existing one and inheriting options with
CreateClient
- http client builder: add
FromOptions
which gets configured viaFluentHttpClientOptions
- http client builder: rename
Build
toBuildOptions
andBuild
now returns the http client - http client builder:
WithRequestBuilderDefaults
now will combine previous defaults instead of replacing them. If you want to replace the previous defaults (as it was working), useWithRequestBuilderDefaults(..., replace: true)
. This behavior is changed because its more expected that they are combined, especially when creating a sub-client and adding/changing request defaults would loose the previous defaults from the creator (parent). - http client factory: add overload
Add(IFluentHttpClient)
- http client builder:
Build
has been renamed toBuildOptions
and addBuild
which now returns an Http Client. Most probably it won't affect anyone since its more for internal use
2.1.2 (2018-10-24)
- build: build correctly as
Release
mode
2.1.1 (2018-10-13)
- util: expose FluentlyHttpClient version via
FluentlyHttpClientMeta.Version
2.1.0 (2018-09-14)
-
util: implemented more powerful options to querystring
CollectionMode
- this will allow to configure collection items in querystrings as below:KeyPerValue
e.g."filter=assassin&filter=fighter"
CommaSeparated
e.g."filter=assassin,fighter"
CollectionItemFormatter
- Allows you to format item value e.g. take enum description value. (see tests)KeyFormatter
- Allows you to format key with via a custom function e.g. lowercase, camelCase, PascalCase and you can utilize other libraries such as humanizer.
-
request builder: now using the new querystring options
WithQueryParams(object queryParams, QueryStringOptions options)
(and similar withAction
) -
request builder:
WithQueryParamsOptions(QueryStringOptions options)
(and similar withAction
) which can be used nicer in conjuction withWithRequestBuilderDefaults
as below:
clientBuilder.WithRequestBuilderDefaults(builder =>
builder.WithQueryParamsOptions(opts =>
{
opts.CollectionMode = QueryStringCollectionMode.CommaSeparated;
opts.KeyFormatter = key => key.ToUpper();
})
);
- request builder:
WithQueryParams(object queryParams, bool lowerCaseQueryKeys)
has been marked as obsolete, instead the newlyWithQueryParams(object queryParams, Action<QueryStringOptions> configure)
. e.g.WithQueryParams(params, opts => opts.KeyFormatter = key => key.ToLower())
2.0.1 (2018-07-31)
- querystring builder: fix issue with query string when have multiple values.
2.0.0 (2018-06-24)
-
deps: update to .net standard 2.0 + .net core 2.1.
-
deps: remove
WinInsider.System.Net.Http.Formatting
and replaced withMicrosoft.AspNet.WebApi.Client
. -
http client: now using
IHttpClientFactory
inorder to createHttpClient
(without message handler) -
services:
AddFluentlyHttpClient
now usesTryAddSingleton
and registersAddHttpClient
-
request builder: when building querystring now supports collections
e.g.
Roles = new List<string> { "warrior", "assassin" }
=>roles=warrior&roles=assassin
-
timer middleware: add
UseTimer(this FluentHttpClientBuilder builder, Action<TimerHttpMiddlewareOptions> configure = null)
overload. -
logger middleware: add
WithLoggingOptions(this FluentHttpRequestBuilder builder, Action<LoggerHttpMiddlewareOptions> configure = null)
overload. -
logger middleware: add
UseLogging(this FluentHttpClientBuilder builder, Action<LoggerHttpMiddlewareOptions> configure = null)
overload.
- timer middleware: increase warning threshold to
400
ms by default.
- Removed deprecated code
IDictionary.Set
,FluentHttpClientBuilder.Withdentifier
(typo) andFluentHttpClientBuilder.WithFormatters
1.4.4 (2018-06-11)
- request builder: fix issue with query string
.WithQueryParams
when value is empty string.
1.4.3 (2018-04-07)
- request builder: losen parsing for
userAgent
header, since errors are thrown when having user agent like the below which seems to be still valid.Mozilla/5.0 (Linux; Android 6.0; vivo 1601 Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/63.0.3239.111 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/153.0.0.53.88;]
1.4.2 (2018-03-18)
- timer middleware: now logs even when an exception is thrown, which might be useful when a timeout has triggered.
- timer middleware:
SetTimeTaken
now returnsFluentHttpResponse
instead ofvoid
.
1.4.1 (2018-03-04)
- request builder: items within request/response e.g. time taken (from timer middleware) were updating the request builder items which was causing susequent requests built by the same request builder to fail.
- http client builder:
Withdentifier
has been renamed correctly toWithIdentifier
previous one was marked as obsolete.
- http client builder:
Withdentifier
has been marked as obsolete, instead the newlyWithIdentifier
.
1.4.0 (2018-03-03)
- logger middleware: add
LoggerHttpMiddlewareOptions
to configureShouldLogDetailedRequest
andShouldLogDetailedResponse
. - logger middleware: add
WithLoggingOptions
on request builder, to specify options per request. - timer middleware: add
WithTimerWarnThreshold
on request builder, to specify options per request.
1.3.0 (2018-02-24)
- http client builder: add
ConfigureFormatters
which now able to configureDefault
formatter to be used. - sample: add sample for MessagePack formatter - see
MessagePackIntegrationTest
andMessagePackMediaTypeFormatter
.
- http client builder:
WithFormatters
has been marked as obsolete, instead the newlyConfigureFormatters
.
1.2.1 (2018-02-16)
- regex extensions:
ReplaceTokens
now validates object instead of throwing null reference exception. This now will give better errors when using interpolations without value. - request builder:
WithQueryParams
now omits query param when value is null instead of null reference exception.
- collection extensions:
Set
has been marked as obsolete, as it can be replaced by 1 liner.
1.2.0 (2018-01-12)
- graphql: add support for GraphQL to have simpler api's specifically for GraphQL. (thanks to Kurt Cassar for contribution)
- consts: add
XForwardedFor
inHeaderTypes
.
New apis such as:
fluentHttpClient.CreateGqlRequest(query)
- Creates a new HTTP request and configure for GraphQL.requestBuilder.AsGql(query)
- Configures an existing HTTP request builder as a GraphQL request.requestBuilder.ReturnAsGqlResponse<T>()
- Sends request and unwrap GraphQL data to be available directly in the.Data
.
See documentation for an example on how it can be used.
1.1.0 (2017-07-02)
-
request builder: implement
WithItem
which allows to set custom items that can be used to share data within the scope of request, response, and middleware. -
request builder: add
WithUserAgent
extension. -
request builder: add validation for request when 'GET' and has body content, to not be allowed. As it will blow up the underlying HttpClient.
-
request: add
Formatters
which can be useful for middleware. -
message state: extract interface
IFluentHttpMessageState
, which bothFluentHttpRequest
andFluentHttpResponse
implements. This will allow sharing implementations for extensions methods acrossFluentHttpRequest
andFluentHttpResponse
related toItems
. -
header builder: extract interface
IFluentHttpHeaderBuilder
, which bothFluentHttpClientBuilder
andFluentHttpRequestBuilder
implements. This will allow sharing implementations for extensions methods acrossFluentHttpClientBuilder
andFluentHttpRequestBuilder
related toHeaders
. -
http client builder: formatter JSON is now configured with camelcase property names by default.
-
http client builder: now shares request builder headers extensions such as
WithUserAgent
andWithBearerAuthentication
. -
http client builder: implement
ConfigureDefaults
which enables to configure defaults for newly created http clients. -
logger middleware: add extension method
UseLogging
. -
consts: add constants for headers and auth schemes
HeaderTypes
andAuthSchemeTypes
1.0.0 (2017-06-30)
-
http client factory:
Remove
now disposesIFluentHttpClient
. -
http client builder: implement
WithFormatters
to be able to configure formatters. -
http client: implement
IDisposable
in order to dispose underlyingHttpClient
. -
request builder: implement
ReturnAsString
,ReturnAsStream
andReturnAsByteArray
. -
request:
Method
andUri
has now also setters. -
request: add
Items
in order to share state across requests/response. -
response:
StatusCode
andReasonPhrase
has now also setters. -
response:
Items
now are shared with request. -
response: expose
Content
fromMessage
. -
**middleware:**now supports arguments via
UseMiddleware<T>(args)
. -
timer middleware: now supports options, for configure
WarnThreshold
. -
timer middleware: add extension method
UseTimer
for convience.
-
http client builder: rename
AddMiddleware
toUseMiddleware
. -
http client builder:
UseMiddleware<T>
, is now constrained withIFluentHttpMiddleware
. -
request: rename
Url
toUri
.
FluentHttpClientBuilder.AddMiddleware
has been renamed toFluentHttpClientBuilder.UseMiddleware
.FluentHttpClientBuilder.UseMiddleware
is now constrained withIFluentHttpMiddleware
.FluentHttpRequest.Url
has been renamed toFluentHttpRequest.Uri
.FluentHttpRequest
renameRawRequest
toMessage
FluentHttpResponse
renameRawResponse
toMessage
0.3.0 (2017-06-28)
-
http client factory: validate options on
Add
, in order to have better errors. -
http client factory: add default options to reduce the amount of config required (when not specified).
-
http client factory:
Add
now returns newly createdFluentHttpClient
. -
http client factory: implement
WithRequestBuilderDefaults
additional hook in order customizeFluentHttpRequestBuilder
on creation. -
http client factory: implement
WithMessageHandler
in order to replace the HTTP stack for the HTTP client. -
http client factory: implement
Add
withFluentHttpClientOptions
. -
http client factory: extract interface
IFluentHttpClientFactory
fromFluentHttpClientFactory
. -
http client builder: add new method
AddMiddleware(Type)
. -
http client builder: align naming with request builder.
-
request builder: implement
WithSuccessStatus
to specify or not whether to throw or not when request is not successful. -
request builder: implement
WithCancellationToken
to be able to cancel http request. -
request builder: Http method now defaults as
Get
. -
http client: implement
Patch
andDelete
methods. -
http client: extract interface
IFluentHttpClient
fromFluentHttpClient
.
IFluentHttpResponse
has been removed and addedFluentHttpResponse
instead. In addition, most ofFluentHttpResponse<T>
method has been changed withFluentHttpResponse
. Most of the changes should only effect the internals, apart from middlewares.- Now requests created by
FluentHttpRequestBuilder
won't throw unless specified when request is not succeeded. FluentHttpClientFactory.Add
now returns the newFluentHttpClient
instance instead ofFluentHttpClientFactory
.FluentHttpClientBuilder
methods naming alignmentSetBaseUrl
=>WithBaseUrl
SetTimeout
=>WithTimeout
AddHeader
=>WithHeader
AddHeaders
=>WithHeaders
AddHeaders
=>WithHeaders
- Middleware related has been moved to
FluentlyHttpClient.Middleware
namespace, this effects:LoggerHttpMiddleware
TimerHttpMiddleware
IFluentHttpMiddleware
IFluentHttpMiddlewareRunner
FluentHttpClientFactory
usages now is changed withIFluentHttpClientFactory
FluentHttpClient
usages now is changed withIFluentHttpClient
0.2.1 (2017-06-25)
-
request builder: validate request on
Build
, in order to have better errors. -
request builder: implement query string
WithQueryParams
. -
request builder: implement headers
WithHeader
,WithHeaders
andWithBearerAuthentication
. -
http client: implement
Send
method withFluentHttpRequest
. -
http client builder: implement
AddHeaders
which accepts a dictionary. -
http client builder:
AddHeader
now replaces, instead of throwing when already defined.