Skip to content

Commit fa0c59e

Browse files
authored
Merge pull request #512 from microsoft/fix/browser-message-handler
fix: browser/wasm message handler being returned was incompatible
2 parents 6ac8f80 + a006107 commit fa0c59e

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/http/httpClient/KiotaClientFactory.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,10 @@ public static HttpMessageHandler GetDefaultHttpMessageHandler(IWebProxy? proxy =
185185
// https://github.com/dotnet/runtime/blob/main/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs#L575
186186
var proxyPolicy = proxy != null ? WindowsProxyUsePolicy.UseCustomProxy : WindowsProxyUsePolicy.UseWinHttpProxy;
187187
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 };
188-
#elif NET5_0_OR_GREATER
188+
#elif NET5_0_OR_GREATER && !BROWSER
189189
return new SocketsHttpHandler { Proxy = proxy, AllowAutoRedirect = false, EnableMultipleHttp2Connections = true, AutomaticDecompression = DecompressionMethods.All };
190+
#elif BROWSER
191+
return new HttpClientHandler { AllowAutoRedirect = false };
190192
#else
191193
return new HttpClientHandler { Proxy = proxy, AllowAutoRedirect = false, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate };
192194
#endif

src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Description>Kiota Http provider implementation for dotnet with HttpClient.</Description>
66
<AssemblyTitle>Kiota Http Library for dotnet</AssemblyTitle>
77
<!-- NET 5 target to be removed on next major version-->
8-
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0;net462</TargetFrameworks>
8+
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0;net462;net8.0-browser;</TargetFrameworks>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
</PropertyGroup>
1111

0 commit comments

Comments
 (0)