Skip to content

Releases: scottoffen/fluenthttpclient

3.0.5

01 Mar 00:30
afce371

Choose a tag to compare

What's Changed

  • Renamed the static class for global options to FluentHttpClientOptions by @scottoffen in #19

Full Changelog: 3.0.4...3.0.5

3.0.4

15 Feb 00:43
d326b57

Choose a tag to compare

  • Enables nullable in the csproj
  • Adds an extension methods for .WithQueryParam that takes nullable objects. If the object is null, an empty string is added. If the object is not null, adds the result of ToString()
  • Adds an extension method HttpClient.WithoutRoute(), set's the route to an empty string

3.0.3

10 Jan 19:13
fbc81b6

Choose a tag to compare

Fix breaking issue with query parameters not being sent with request. (#14)

3.0.2

10 Jan 04:35

Choose a tag to compare

Adds target for .Net 8.0

This version now targets .Net 6.0, .Net 7.0 and .Net 8.0

#8 Trailing Slashes Should Not Be Added When Route Is Empty

Fixes issue where trailing slash was being added if no value was provided for Route.
To intentionally include a trailing slash, use a slash for the route instead of leaving it blank.

client.UsingRoute(); // no trailing slash
client.UsingRoute("/"); // includes trailing slash

#7 Add HttpRequestException Handler

You can now fluently add an exception handler for HttpRequestException. When not used, the exception will be thrown without any behavior change. When used, the handler is called and a NullHttpResponseMessage object is returned with a StatusCode of 0. The handler must be added before the request is sent.

var response = await _client
    .UsingRoute("/user/list")
    .WithQueryParam("sort", "desc")
    .OnHttpRequestException(ex => { /* exception handling code here */ })
    .GetAsync()
    .OnFailure(msg => { success = false; })
    .OnSuccess(msg => { success = true; });

This will only handle exceptions of type HttpRequestException. All other exception will be unhandled.

An extension method HttpRequestExceptionOccurred on HttpResponseMessage will return true if the object is the subclass NullHttpResponseMessage. You do not need to check this in the OnSuccess nor OnFailure handlers, as neither OnSuccess nor OnFailure handlers will be called when the exception hander is used and an exception is throw, as both of those methods are specific to the response from the external service.

2.1.0

01 Dec 23:39
0ac0b3e

Choose a tag to compare

  • Drops .NetStandard 2.0 target framework
  • Adds .NET 7.0 target framework
  • Adds support for XML deserialization
  • Changes default value of suppressException to true

1.4.0

13 May 16:51
f4a9d0f

Choose a tag to compare

Merge pull request #1 from scottoffen/add-json-extensions

Improve JSON support