Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into andrueastman/kiotaBundle
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Omondi committed Jul 23, 2024
2 parents 02e8afa + 42ea74e commit ba5200f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Adds Kiota bundle package to provide default adapter with registrations setup. [#290](https://github.com/microsoft/kiota-dotnet/issues/290)

## [1.9.11] - 2024-07-22

- Obsoletes custom decompression handler in favor of native client capabilities.

## [1.9.10] - 2024-07-18

- Fix DateTime serialization and deserialization
Expand All @@ -31,4 +35,4 @@ Refer to the following for earlier releases of libraries in the project.
1. [Serialization - JSON](./src/serialization/json/Changelog-old.md)
1. [Serialization - FORM](./src/serialization/form/Changelog-old.md)
1. [Serialization - TEXT](./src/serialization/text/Changelog-old.md)
1. [Serialization - MULTIPART](./src/serialization/multipart/Changelog-old.md)
1. [Serialization - MULTIPART](./src/serialization/multipart/Changelog-old.md)
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
<IsPackable>false</IsPackable>
<OutputType>Library</OutputType>
</PropertyGroup>
</Project>
</Project>
6 changes: 3 additions & 3 deletions src/http/httpClient/KiotaClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ public static HttpMessageHandler GetDefaultHttpMessageHandler(IWebProxy? proxy =
// If custom proxy is passed, the WindowsProxyUsePolicy will need updating
// https://github.com/dotnet/runtime/blob/main/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs#L575
var proxyPolicy = proxy != null ? WindowsProxyUsePolicy.UseCustomProxy : WindowsProxyUsePolicy.UseWinHttpProxy;
return new WinHttpHandler { Proxy = proxy, AutomaticDecompression = DecompressionMethods.None, WindowsProxyUsePolicy = proxyPolicy, SendTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveDataTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveHeadersTimeout = System.Threading.Timeout.InfiniteTimeSpan, EnableMultipleHttp2Connections = true };
return new WinHttpHandler { Proxy = proxy, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, WindowsProxyUsePolicy = proxyPolicy, SendTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveDataTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveHeadersTimeout = System.Threading.Timeout.InfiniteTimeSpan, EnableMultipleHttp2Connections = true };
#elif NET5_0_OR_GREATER
return new SocketsHttpHandler { Proxy = proxy, AllowAutoRedirect = false, EnableMultipleHttp2Connections = true };
return new SocketsHttpHandler { Proxy = proxy, AllowAutoRedirect = false, EnableMultipleHttp2Connections = true, AutomaticDecompression = DecompressionMethods.All };
#else
return new HttpClientHandler { Proxy = proxy, AllowAutoRedirect = false };
return new HttpClientHandler { Proxy = proxy, AllowAutoRedirect = false, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate };
#endif
}
}
Expand Down
1 change: 1 addition & 0 deletions src/http/httpClient/Middleware/CompressionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Microsoft.Kiota.Http.HttpClientLibrary.Middleware
/// <summary>
/// A <see cref="DelegatingHandler"/> implementation that handles compression.
/// </summary>
[Obsolete("kiota clients now rely on the HttpClientHandler to handle decompression")]

Check warning on line 19 in src/http/httpClient/Middleware/CompressionHandler.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 19 in src/http/httpClient/Middleware/CompressionHandler.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 19 in src/http/httpClient/Middleware/CompressionHandler.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 19 in src/http/httpClient/Middleware/CompressionHandler.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)

Check warning on line 19 in src/http/httpClient/Middleware/CompressionHandler.cs

View workflow job for this annotation

GitHub Actions / Build

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)
public class CompressionHandler : DelegatingHandler
{
internal const string GZip = "gzip";
Expand Down
2 changes: 2 additions & 0 deletions tests/http/httpClient/KiotaClientFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ public void CreateWithNullOrEmptyHandlersReturnsHttpClient()
public void CreateWithCustomMiddlewarePipelineReturnsHttpClient()
{
var handlers = KiotaClientFactory.CreateDefaultHandlers();
#pragma warning disable CS0618 // Type or member is obsolete
handlers.Add(new CompressionHandler());
#pragma warning restore CS0618 // Type or member is obsolete
var client = KiotaClientFactory.Create(handlers);
Assert.IsType<HttpClient>(client);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace Microsoft.Kiota.Http.HttpClientLibrary.Tests.Middleware
{
[Obsolete("kiota clients now rely on the HttpClientHandler to handle decompression")]
public class CompressionHandlerTests : IDisposable
{
private readonly MockRedirectHandler _testHttpMessageHandler;
Expand Down

0 comments on commit ba5200f

Please sign in to comment.