Releases: kampute/http-client
2.3.1
This release brings crucial security improvements, minor fixes, and upgrades:
- Increased the minimum version of the
System.Text.Json
package due to a severe vulnerability in the previous version. - Fixed various typos in the documentation to improve readability and understanding.
- Upgraded the .NET version of the test projects to 8.0 due to the end of life of the previously used version, 6.0, ensuring continued support and access to the latest features.
Thank you for your continued support and feedback!
2.3.0
This release introduces a new feature, several enhancements, and improves clarity in method naming:
- Added the
HttpRequestScope
class, which allows for scoped modifications of properties and headers for HTTP requests sent using theHttpRestClient
. This feature enables developers to configure and reuse scopes across different parts of the application, improving modularity and reducing redundancy. - Introduced the
WithScope
extension method for theHttpRestClient
class, making it straightforward to create and manage these scopes. This method ensures that all modifications are temporary and only apply to the requests made within the scope. - Improved error messages in case of response deserialization failures to enhance clarity and provide more detailed information.
- Added
With
prefix to extension methods modifying retry strategies, ensuring consistency and clarity in the API's method naming conventions.
Thank you for your continued support and feedback!
2.2.1
This release includes a bug fix and several minor optimizations:
- Resolved an
ArgumentNullException
in theFlyweightCache
class's default constructor that could occur under certain conditions. - Added the
HasActiveScope
property to theScopedCollection
class, allowing for straightforward detection of active scopes. - Eliminated lazy initialization of property and header scopes in the
HttpRestClient
class to reduce unnecessary overhead.
Thank you for your attention to this release!
2.2.0
This release introduces improved flexibility for managing headers and properties within scopes:
- The
BeginHeaderScope
method now allows for the removal of headers. To remove a header during the scope's lifetime, in the collection of scoped headers, simply set its value tonull
. - Similarly, the
BeginPropertyScope
method facilitates the removal of request properties by setting the property value tonull
.
These changes ensure more dynamic control over HTTP headers and properties, simplifying customization per request.
Thank you for your attention to this update!
2.1.1
In this release, we have addressed a bug.
- Corrected the definition of delegate used in the
HttpError401Handler
class, changing type of itscontext
parameter fromHttpRequestErrorContext
toHttpResponseErrorContext
.
Thank you for your attention to this update!
2.1.0
In this release, we focused on refining content deserialization handling and enhancing documentation clarity. Check out what’s new:
- Introduced lazy caching in the
HttpContentDeserializerCollection
class to optimize performance and resource utilization. - Modified the FlyweightCache class by replacing its indexer with a method because, unlike an indexer, a method can be used as a delegate.
- Updated the minimum required version of the
System.Text.Json
library in theKampute.HttpClient.Json
package from 8.0.2 to 8.0.3, to ensure utilization of a bug-free library. - Enhanced various parts of our documentation to provide clearer and more detailed information.
Thank you for your ongoing support and look forward to your feedback on these enhancements!
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!
1.6.0
In this update, we continue our mission to improve the developer experience, optimize resource management, and ensure the flexibility and reliability of the library. Here is what's new:
- Introduced the
GzipCompressedContent
andDeflateCompressedContent
classes to provide built-in support for Gzip and Deflate compression methods. These classes simplify the process of applying compression toHttpContent
, aiming to enhance network efficiency and performance. - Added
AsGzip
andAsDeflate
extension methods forHttpContent
that allow developers to easily compress data before sending it over the network. This update extends our library's functionality, offering more flexibility in handling HTTP requests and responses. - Enhanced the
IsReusable
extension method forHttpContent
to more accurately determine if an instance can be reused. This improvement is crucial for scenarios where a failed request might need to be retried, ensuring that HTTP content can be sent again without needing to recreate it from scratch. - Updated various XML comments throughout the code to enhance documentation clarity and reflect the introduction of new compression features. This ensures that developers can fully leverage new functionalities with a clear understanding of their implementation and benefits.
These updates reflect our ongoing commitment to our developer community. Your feedback is crucial in guiding our developments and enhancements. We appreciate your continued support and collaboration.
1.5.0
In this update, we continue our mission to improve the developer experience, optimize resource management, and ensure the flexibility and reliability of the library. Here is what's new in the latest release:
- Introduced the
DownloadAsync
method to theHttpRestClient
class. This method offers an enhancement over the existingFetchToStreamAsync
by allowing the caller to decide how to create the download target stream based on the received content headers, providing greater flexibility and control over the download process. - Relocated the
FetchToStreamAsync
method from theHttpRestClient
class, transforming it into an extension method. This change improves the modularity and reusability of our codebase, aligning with modern development practices. - Updated various XML comments throughout the code to reflect these changes and to enhance documentation clarity.
These updates reflect our ongoing commitment to our developer community. Your feedback is crucial in guiding our developments and enhancements. We appreciate your continued support and collaboration.
1.4.1
In this update, we've tackled an issue where responses lacking a body but with a specified return type would lead to the client returning the default value for that type, which could cause unexpected behavior. To enhance clarity and predictability in error handling, we have revised the implementation to throw an HttpContentException
under these circumstances. This modification ensures developers are promptly informed about missing response bodies, thereby avoiding the unintentional use of default values.
We appreciate your ongoing support and engagement.