Releases: skybrud/Skybrud.Essentials.Http
v1.2.0
Installation
Install via NuGet - either via the .NET CLI:
dotnet add package Skybrud.Essentials.Http --version 1.2.0
or the NuGet package manager:
Install-Package Skybrud.Essentials.Http -Version 1.2.0
Changelog
-
Added constructor overload to the
HttpException
class (see ad19505)
TheHttpException
class already had a constructor taking an instance ofIHttpResponse
, but didn't allow specifying a custom exception message. The new constructor overload also take anIHttpResponse
via the first parameter, but then the exception message via the second parameter. -
Dropped .NET Standard 1.3 as a target framework (see ebeeced)
.NET Standard 1.3 probably isn't used that anymore, and supporting it meant a lot of compiler flags, so removing support for .NET Standard 1.3 also helps cleaning up the code. -
Removed all
DoHttp...
style methods (see 1d7110a)
Earlier versions of the package had methods likeDoHttpGetRequest
andDoHttpPostRequest
, which overtime were replaced as the naming felt a bit clumsy. The methods have however remained in the package for legacy support, but as the methods have been marked as obsolete for a long time, and alternatives have existed in the package even longer, it's probably about time to remove the methods. -
Added misc async methods to the
HttpClient
class (see 7262fb5)
TheHttpClient
class have non-async methods likeGet
,Post
and similar. When I added async support to the package, I implemented similar methods for async, but as extension methods. These work fine, but the implementation may not always feel as elegant, so now theHttpClient
class has similarGetAsync
,PostAsync
and similar methods. -
More
HttpClient
parameters should allow null values (see 0e36692)
When support for nullable reference types were introduced to the package, not all parameters were decorated to allow null values. This release adds more nullable decorations to allow null values for parameters where the underlying logic already supports it.
v1.1.5
Installation
Install via NuGet - either via the .NET CLI:
dotnet add package Skybrud.Essentials.Http --version 1.1.5
or the NuGet package manager:
Install-Package Skybrud.Essentials.Http -Version 1.1.5
Changelog
-
Fixed issues with query string not being passed on to underlying code (see ea53ed6)
-
Added support for
NameValueCollection
parameters for more target frameworks (see 967dc7d)
Until now method overloads taking aNameValueCollection
parameter have only been available for the builds targeting .NET Framework, but as .NET Standard 2.0+ and .NET 5+ also supportNameValueCollection
, the same method overloads should be available for these target frameworks as well. -
Updated the
Skybrud.Essentials
dependency (see 84c77a8)
v1.1.4
Installation
Install via NuGet - either via the .NET CLI:
dotnet add package Skybrud.Essentials.Http --version 1.1.4
or the NuGet package manager:
Install-Package Skybrud.Essentials.Http -Version 1.1.4
Changelog
- Updated the Skybrud.Essentials dependency (see e0f7591)
With this release,Skybrud.Essentials.Http
now has a dependency forv1.1.47
ofSkybrud.Essentials
instead ofv1.1.46
. The newer version doesn't contain any new logic directly used bySkybrud.Essentials.Http
, but by updating the dependency, packages or projects consumingSkybrud.Essentials.Http
doesn't have to have an explicit dependency forSkybrud.Essentials
in order to use logic in the newest version.
v1.1.3
Installation
Install the NuGet package - either via the .NET CLI:
dotnet add package Skybrud.Essentials.Http --version 1.1.3
or the NuGet package manager:
Install-Package Skybrud.Essentials.Http -Version 1.1.3
Changelog
-
Introduced new
HttpException
class (see 84dadf8)
The new class provides a concrete implementation of the "IHttpException" interface, and may be used to represent various HTTP errors. -
Added various extension methods for working with
IHttpResponse
(see af6c7c4)
The extension methods includeThrowIfNotSuccessful
, which will trigger an exception if the status code of aIHttpResponse
is not either 200 OK or 201 Created. -
Added
ResponseUri
property to theHttpResponseBase
class (see b4bcc5d)
TheIHttpResponse
interface already describes aResponseUri
property, and asHttpResponseBase
wraps an instanceIHttpResponse
, it might as well expose the underlyingResponseUri
.
v1.1.2
Installation
Install the NuGet package - either via the .NET CLI:
dotnet add package Skybrud.Essentials.Http --version 1.1.2
or the NuGet package manager:
Install-Package Skybrud.Essentials.Http -Version 1.1.2
Changelog
-
Updated the Skybrud.Essentials dependency (see e4a61d1)
Updates the dependency to v1.1.46. -
Added extension methods for setting the authorization header of an
IHttpRequest
(see d3f4da4)
The package already contains aSetAuthorizationHeader
extension method for setting the raw header value. To help developers in more specific cases, the package now also has theSetAuthorizationBasic
andSetAuthorizationBearer
extension methods.
v1.1.1
Installation
Install the NuGet package - either via the .NET CLI:
dotnet add package Skybrud.Essentials.Http --version 1.1.1
or the NuGet package manager:
Install-Package Skybrud.Essentials.Http -Version 1.1.1
Changelog
- Enabled support for nullable reference types (see d07bec6)
This includes adding .NET 5 and .NET 6 as additional target frameworks, as they come with extended code analysis functionality out of the box. The Nullable package is added a development dependency to older target frameworks to provide the same code analysis functionality.
v1.1.0
Installation
Install the NuGet package - either via the .NET CLI:
dotnet add package Skybrud.Essentials.Http --version 1.1.0
or the NuGet package manager:
Install-Package Skybrud.Essentials.Http -Version 1.1.0
Breaking changes
🅱️ Added newGetResponseAsync
methods to theIHttpRequest
andHttpRequest
types (see 792c3aa)
This is a breaking change since the release adds a new method to theIHttpRequest
interface.
Other changes
-
Introduced new
IHttpClientAsync
interface (see 7e01cfb)
The new interface serves an async counterpart of the existingIHttpClient
interface, which describes methods for making non-async requests.This commit also makes the
HttpClient
class implement the new interface so it can be used for both non-async and async requests. -
Implemented additional
SetBody
extension methods forIHttpRequest
(see f7b76ac) -
Added additional constructor overloads to the
HttpRequest
class (see c9d361b) -
Added additional HTTP verb method overloads to the
HttpRequest
class (see 994cf87) -
Added various extension methods for
IHttpClientAsync
(see 24edd28 and 87eae0e) -
Added constants for various content types (see fd79309)
-
Marking a lot of code as obsolete (see da53f8f)
In order to get a cleaner implementation, this commits marks a lot of code as obsolete:DoHttp{Verb}Request
methods should no longer be used. UseGet
,Post
,Patch
,Put
andDelete
methods instead- Usage of
IGetOptions
should be replaced byIHttpRequestOptions
along with theGetResponse
method - Usage of
IPostOptions
should be replaced byIHttpRequestOptions
along with theGetResponse
method
v1.0.19
Installation
Install the NuGet package - either via the .NET CLI:
dotnet add package Skybrud.Essentials.Http --version 1.0.19
or the NuGet package manager:
Install-Package Skybrud.Essentials.Http -Version 1.0.19
Changelog
- Improved
HttpRequest.GetResponse
exception handling (see #2 and 484dfff)
.NET's exception handling differs slightly for HTTP protocol errors when comparing .NET Framework and .NET Standard, so the .NET Standard version of this package didn't properly detectWebException
exceptions as they were hidden behind anAggregateException
. With this release,WebException
exception are now properly detected from the inner exception of theAggregateException
.
v1.0.18
Installation
Changelog
- Updated the
Skybrud.Essentials
dependency (see 5033a6f)
The dependency has now been bumped fromv1.1.36
tov1.1.38
.
v1.0.17
Installation
Changelog
-
Introduced new
TryGet{Type}
extension methods forIHttpQueryString
(see #1 and 5d28f87)
This release introduces a number of extension methodsIHttpQueryString
for attempting to get values in different types - eg.TryGetBoolean
,TryGetInt32
and similar. -
Added null checks to the
HttpQueryString.Add
andHttpQueryString.Set
methods (see c9fc87f)
The methods now properly handle when being passed a null value. -
Added
Parse
methods to theHttpQueryString
class, obsoleting the existingParseQueryString
methods (see fc3b31d)
HavingQueryString
in the method names feels a bit redundant, so the twoParseQueryString
methods have now been marked as obsolete, and twoParse
methods have been added to replace them. -
Added
TryParse
methods to theHttpQueryString
class (see 924dbdb)
As theParse
methods may fail if passed an invalid string representation of a query string, so the twoTryParse
methods in this release encapsulates any error handling should the parsing fail.