diff --git a/src/Kampute.HttpClient.DataContract/Kampute.HttpClient.DataContract.csproj b/src/Kampute.HttpClient.DataContract/Kampute.HttpClient.DataContract.csproj
index 75f31a6..f94f6e0 100644
--- a/src/Kampute.HttpClient.DataContract/Kampute.HttpClient.DataContract.csproj
+++ b/src/Kampute.HttpClient.DataContract/Kampute.HttpClient.DataContract.csproj
@@ -5,7 +5,7 @@
Kampute.HttpClient.DataContract
This package is an extension package for Kampute.HttpClient, enhancing it to manage application/xml content types, using DataContractSerializer for serialization and deserialization of XML responses and payloads.
Kambiz Khojasteh
- 2.3.0
+ 2.3.1
Kampute
Copyright (c) 2024 Kampute
latest
@@ -27,7 +27,7 @@
- true
+ true
../../SigningKey.snk
diff --git a/src/Kampute.HttpClient.Json/Kampute.HttpClient.Json.csproj b/src/Kampute.HttpClient.Json/Kampute.HttpClient.Json.csproj
index 483e813..bfb5fea 100644
--- a/src/Kampute.HttpClient.Json/Kampute.HttpClient.Json.csproj
+++ b/src/Kampute.HttpClient.Json/Kampute.HttpClient.Json.csproj
@@ -5,7 +5,7 @@
Kampute.HttpClient.Json
This package is an extension package for Kampute.HttpClient, enhancing it to manage application/json content types, using System.Text.Json library for serialization and deserialization of JSON responses and payloads.
Kambiz Khojasteh
- 2.3.0
+ 2.3.1
Kampute
Copyright (c) 2024 Kampute
latest
@@ -27,7 +27,7 @@
- true
+ true
../../SigningKey.snk
@@ -36,7 +36,7 @@
-
+
diff --git a/src/Kampute.HttpClient.NewtonsoftJson/Kampute.HttpClient.NewtonsoftJson.csproj b/src/Kampute.HttpClient.NewtonsoftJson/Kampute.HttpClient.NewtonsoftJson.csproj
index 473c436..dd8c800 100644
--- a/src/Kampute.HttpClient.NewtonsoftJson/Kampute.HttpClient.NewtonsoftJson.csproj
+++ b/src/Kampute.HttpClient.NewtonsoftJson/Kampute.HttpClient.NewtonsoftJson.csproj
@@ -5,7 +5,7 @@
Kampute.HttpClient.NewtonsoftJson
This package is an extension package for Kampute.HttpClient, enhancing it to manage application/json content types, using Newtonsoft.Json library for serialization and deserialization of JSON responses and payloads.
Kambiz Khojasteh
- 2.3.0
+ 2.3.1
Kampute
Copyright (c) 2024 Kampute
latest
@@ -27,7 +27,7 @@
- true
+ true
../../SigningKey.snk
diff --git a/src/Kampute.HttpClient.Xml/Kampute.HttpClient.Xml.csproj b/src/Kampute.HttpClient.Xml/Kampute.HttpClient.Xml.csproj
index 51e513b..522c3df 100644
--- a/src/Kampute.HttpClient.Xml/Kampute.HttpClient.Xml.csproj
+++ b/src/Kampute.HttpClient.Xml/Kampute.HttpClient.Xml.csproj
@@ -5,7 +5,7 @@
Kampute.HttpClient.Xml
This package is an extension package for Kampute.HttpClient, enhancing it to manage application/xml content types, using XmlSerializer for serialization and deserialization of XML responses and payloads.
Kambiz Khojasteh
- 2.3.0
+ 2.3.1
Kampute
Copyright (c) 2024 Kampute
latest
@@ -27,7 +27,7 @@
- true
+ true
../../SigningKey.snk
diff --git a/src/Kampute.HttpClient/ErrorHandlers/HttpError503Handler.cs b/src/Kampute.HttpClient/ErrorHandlers/HttpError503Handler.cs
index e9fd3a8..dbc0a2b 100644
--- a/src/Kampute.HttpClient/ErrorHandlers/HttpError503Handler.cs
+++ b/src/Kampute.HttpClient/ErrorHandlers/HttpError503Handler.cs
@@ -41,7 +41,7 @@ public class HttpError503Handler : IHttpErrorHandler
/// -
/// context
///
- /// Provides context about the HTTP responce indicating a '503 Service Unavailable' error. It is encapsulated within
+ /// Provides context about the HTTP response indicating a '503 Service Unavailable' error. It is encapsulated within
/// an instance, allowing for an informed decision on the retry strategy.
///
///
diff --git a/src/Kampute.HttpClient/HttpContentDeserializerCollection.cs b/src/Kampute.HttpClient/HttpContentDeserializerCollection.cs
index be34fd5..4101158 100644
--- a/src/Kampute.HttpClient/HttpContentDeserializerCollection.cs
+++ b/src/Kampute.HttpClient/HttpContentDeserializerCollection.cs
@@ -288,7 +288,7 @@ public IReadOnlyCollection GetSupportedMediaTypes(Type modelType, Type e
}
///
- /// Clears the chace.
+ /// Clears the cache.
///
public void Clear()
{
diff --git a/src/Kampute.HttpClient/HttpErrorHandlerCollection.cs b/src/Kampute.HttpClient/HttpErrorHandlerCollection.cs
index bf9c50c..c00826a 100644
--- a/src/Kampute.HttpClient/HttpErrorHandlerCollection.cs
+++ b/src/Kampute.HttpClient/HttpErrorHandlerCollection.cs
@@ -43,7 +43,7 @@ public sealed class HttpErrorHandlerCollection : ICollection
/// Retrieves all instances in the collection that support handling a specific HTTP status code.
///
/// The HTTP status code to query.
- /// An enumrable of that can handle the specified status code.
+ /// An enumerable of that can handle the specified status code.
public IEnumerable GetHandlersFor(HttpStatusCode statusCode)
{
return _collection.Where(errorHandler => errorHandler.CanHandle(statusCode));
diff --git a/src/Kampute.HttpClient/Kampute.HttpClient.csproj b/src/Kampute.HttpClient/Kampute.HttpClient.csproj
index d49a980..6d63377 100644
--- a/src/Kampute.HttpClient/Kampute.HttpClient.csproj
+++ b/src/Kampute.HttpClient/Kampute.HttpClient.csproj
@@ -5,7 +5,7 @@
Kampute.HttpClient
Kampute.HttpClient is a versatile and lightweight .NET library that simplifies RESTful API communication. Its core HttpRestClient class provides a streamlined approach to HTTP interactions, offering advanced features such as flexible serialization/deserialization, robust error handling, configurable backoff strategies, and detailed request-response processing. Striking a balance between simplicity and extensibility, Kampute.HttpClient empowers developers with a powerful yet easy-to-use client for seamless API integration across a wide range of .NET applications.
Kambiz Khojasteh
- 2.3.0
+ 2.3.1
Kampute
Copyright (c) 2024 Kampute
latest
diff --git a/tests/Kampute.HttpClient.DataContract.Test/Kampute.HttpClient.DataContract.Test.csproj b/tests/Kampute.HttpClient.DataContract.Test/Kampute.HttpClient.DataContract.Test.csproj
index 9480d0f..aac1829 100644
--- a/tests/Kampute.HttpClient.DataContract.Test/Kampute.HttpClient.DataContract.Test.csproj
+++ b/tests/Kampute.HttpClient.DataContract.Test/Kampute.HttpClient.DataContract.Test.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
false
true
latest
@@ -10,10 +10,10 @@
-
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/tests/Kampute.HttpClient.Json.Test/Kampute.HttpClient.Json.Test.csproj b/tests/Kampute.HttpClient.Json.Test/Kampute.HttpClient.Json.Test.csproj
index 59df174..74348e5 100644
--- a/tests/Kampute.HttpClient.Json.Test/Kampute.HttpClient.Json.Test.csproj
+++ b/tests/Kampute.HttpClient.Json.Test/Kampute.HttpClient.Json.Test.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
false
true
latest
@@ -10,10 +10,10 @@
-
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/tests/Kampute.HttpClient.Json.Test/TestModel.cs b/tests/Kampute.HttpClient.Json.Test/TestModel.cs
index 2924e38..b791e92 100644
--- a/tests/Kampute.HttpClient.Json.Test/TestModel.cs
+++ b/tests/Kampute.HttpClient.Json.Test/TestModel.cs
@@ -5,7 +5,7 @@
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
- public class TestModel
+ public partial class TestModel
{
public string? Name { get; set; }
@@ -28,7 +28,7 @@ static string ToJson(string? value)
if (value is null)
return "null";
- var escaped = Regex.Replace(value, @"[\u0000-\u001F\\""]", match =>
+ var escaped = SpecialCharacters().Replace(value, match =>
{
var c = match.Value[0];
return c switch
@@ -52,5 +52,8 @@ static string ToJson(string? value)
{
UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow
};
+
+ [GeneratedRegex(@"[\u0000-\u001F\\""]")]
+ private static partial Regex SpecialCharacters();
}
}
diff --git a/tests/Kampute.HttpClient.NewtonsoftJson.Test/Kampute.HttpClient.NewtonsoftJson.Test.csproj b/tests/Kampute.HttpClient.NewtonsoftJson.Test/Kampute.HttpClient.NewtonsoftJson.Test.csproj
index 2ce7912..ac27e64 100644
--- a/tests/Kampute.HttpClient.NewtonsoftJson.Test/Kampute.HttpClient.NewtonsoftJson.Test.csproj
+++ b/tests/Kampute.HttpClient.NewtonsoftJson.Test/Kampute.HttpClient.NewtonsoftJson.Test.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
false
true
latest
@@ -10,10 +10,10 @@
-
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/tests/Kampute.HttpClient.NewtonsoftJson.Test/TestModel.cs b/tests/Kampute.HttpClient.NewtonsoftJson.Test/TestModel.cs
index 6122237..b886a3e 100644
--- a/tests/Kampute.HttpClient.NewtonsoftJson.Test/TestModel.cs
+++ b/tests/Kampute.HttpClient.NewtonsoftJson.Test/TestModel.cs
@@ -4,7 +4,7 @@
using System;
using System.Text.RegularExpressions;
- public class TestModel
+ public partial class TestModel
{
public string? Name { get; set; }
@@ -27,7 +27,7 @@ static string ToJson(string? value)
if (value is null)
return "null";
- var escaped = Regex.Replace(value, @"[\u0000-\u001F\\""]", match =>
+ var escaped = SpecialCharacters().Replace(value, match =>
{
var c = match.Value[0];
return c switch
@@ -52,5 +52,8 @@ static string ToJson(string? value)
NullValueHandling = NullValueHandling.Include,
MissingMemberHandling = MissingMemberHandling.Error,
};
+
+ [GeneratedRegex(@"[\u0000-\u001F\\""]")]
+ private static partial Regex SpecialCharacters();
}
}
diff --git a/tests/Kampute.HttpClient.Test/Kampute.HttpClient.Test.csproj b/tests/Kampute.HttpClient.Test/Kampute.HttpClient.Test.csproj
index 1a2a219..cd846c8 100644
--- a/tests/Kampute.HttpClient.Test/Kampute.HttpClient.Test.csproj
+++ b/tests/Kampute.HttpClient.Test/Kampute.HttpClient.Test.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
false
true
latest
@@ -10,10 +10,10 @@
-
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/tests/Kampute.HttpClient.Test/TestHelpers/MockExtensions.cs b/tests/Kampute.HttpClient.Test/TestHelpers/MockExtensions.cs
index fc8b474..e57e642 100644
--- a/tests/Kampute.HttpClient.Test/TestHelpers/MockExtensions.cs
+++ b/tests/Kampute.HttpClient.Test/TestHelpers/MockExtensions.cs
@@ -12,10 +12,8 @@ internal static class MockExtensions
{
public static void MockHttpResponse(this Mock mockMessageHandler, Func responseFactory)
{
- if (mockMessageHandler is null)
- throw new ArgumentNullException(nameof(mockMessageHandler));
- if (responseFactory is null)
- throw new ArgumentNullException(nameof(responseFactory));
+ ArgumentNullException.ThrowIfNull(mockMessageHandler);
+ ArgumentNullException.ThrowIfNull(responseFactory);
mockMessageHandler.Protected()
.Setup>
@@ -34,8 +32,7 @@ public static void MockHttpResponse(this Mock mockMessageHan
public static void MockHttpResponse(this Mock mockMessageHandler, HttpStatusCode statusCode, HttpContent? content = null)
{
- if (mockMessageHandler is null)
- throw new ArgumentNullException(nameof(mockMessageHandler));
+ ArgumentNullException.ThrowIfNull(mockMessageHandler);
mockMessageHandler.MockHttpResponse(_ => new HttpResponseMessage(statusCode) { Content = content });
}
diff --git a/tests/Kampute.HttpClient.Test/TestHelpers/TestContentDeserializer.cs b/tests/Kampute.HttpClient.Test/TestHelpers/TestContentDeserializer.cs
index c792ef5..967b01d 100644
--- a/tests/Kampute.HttpClient.Test/TestHelpers/TestContentDeserializer.cs
+++ b/tests/Kampute.HttpClient.Test/TestHelpers/TestContentDeserializer.cs
@@ -24,10 +24,8 @@ public bool CanDeserialize(string mediaType, Type? modelType)
public async Task