Skip to content

2.0.0

Compare
Choose a tag to compare
@kampute kampute released this 05 May 07:42
· 8 commits to master since this release
9cdd999

In this update, we are excited to announce significant enhancements designed to boost performance, optimize resource utilization, and increase the flexibility of our library. Here is what's new:

  • Enhanced performance and reduced memory usage across the library, ensuring more efficient operation.
  • Improved the maintainability, reusability, and extensibility of the codebase, paving the way for easier future enhancements.
  • Introduced the ability to define headers and properties scoped specifically to individual request blocks, enhancing customization and control.
  • Added new extension methods to the HttpRestClient class, enabling responses to be obtained as an array of bytes, a string, a stream, or saved directly into a stream.
  • Introduced EmptyContent, representing HTTP content with no data, ideal for specific request scenarios.
  • Launched new utility classes including ScopedCollection, FlyweightCache, and SharedHttpClient to support advanced resource management and sharing strategies.
  • Improved the interface of the SharedDisposable<T> class, enhancing its usability in resource management contexts.

This release includes a major code rewrite, which brings some breaking changes detailed below:

  • The default constructor of the HttpRestClient class now utilizes a shared HttpClient with default configuration. This change simplifies setup but alters behavior related to compressed responses. Customization of this behavior is now possible through the SharedHttpClient.Factory delegate.
  • If the default request headers of the HttpRestClient include an Accept header, the library will not dynamically evaluate the Accept header based on the configured response deserializers and expected response object type. This change reduces unnecessary resource consumption when the expected response media types are predetermined by the caller.
  • The non-generic SendAsync method of HttpRestClient now returns an HttpResponseMessage rather than just HttpResponseHeaders, providing greater flexibility in response processing.
  • Removed the FetchToStream extension method in favor of specific methods tailored to fetch responses as bytes, strings, streams, or to save directly into a stream.
  • Renamed the AsyncGuard<T> class to AsyncUpdateThrottle<T> to better reflect its functionality, with LastUpdateUnixTime now called LastUpdatedTime, returning a DateTimeOffset instead of Unix time.
  • The Acquire method in SharedDisposable<T> has been renamed to AcquireReference, changing its return type to a disposable object enclosing the shared instance, thus removing the need for a Release method.
  • The IRetrySchedulerFactory has been renamed to IBackoffStrategy, and the corresponding extension method from IRetryStrategy is now ToBackoffStrategy.
  • Simplified the delegate parameters for HttpError401Handler to include only the HttpResponseErrorContext and a cancellation token.
  • The GetAcceptableMediaTypes method in HttpContentDeserializerCollection now returns an enumerable of media types as strings, instead of a read-only collection of MediaTypeWithQualityHeaderValue objects.
  • Removed unused dictionary extension methods to streamline the codebase.

We appreciate your feedback and support, which are vital in guiding our continuous development and enhancement efforts.

Thank you!