2.0.0
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
, andSharedHttpClient
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 sharedHttpClient
with default configuration. This change simplifies setup but alters behavior related to compressed responses. Customization of this behavior is now possible through theSharedHttpClient.Factory
delegate. - If the default request headers of the
HttpRestClient
include anAccept
header, the library will not dynamically evaluate theAccept
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 ofHttpRestClient
now returns anHttpResponseMessage
rather than justHttpResponseHeaders
, 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 toAsyncUpdateThrottle<T>
to better reflect its functionality, withLastUpdateUnixTime
now calledLastUpdatedTime
, returning aDateTimeOffset
instead of Unix time. - The
Acquire
method inSharedDisposable<T>
has been renamed toAcquireReference
, changing its return type to a disposable object enclosing the shared instance, thus removing the need for aRelease
method. - The
IRetrySchedulerFactory
has been renamed toIBackoffStrategy
, and the corresponding extension method fromIRetryStrategy
is nowToBackoffStrategy
. - Simplified the delegate parameters for
HttpError401Handler
to include only theHttpResponseErrorContext
and a cancellation token. - The
GetAcceptableMediaTypes
method inHttpContentDeserializerCollection
now returns an enumerable of media types as strings, instead of a read-only collection ofMediaTypeWithQualityHeaderValue
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!