New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blazor does not support System.Net.Http.HttpClientHandler #42405
Comments
Yes, not all features of runtime/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs Lines 51 to 131 in 7f9b8ce
I guess |
Tagging subscribers to this area: @dotnet/ncl |
Thanks @campersau for responding to this. For rc2, we've added an analyzer that should tell you at build time if these APIs are going to be unavailable. /cc @kjpou1 in case you'd like to add more content. |
Not sure what else can be added. The HttpClient uses the browsers underlying fetch implementation. Fetch does not support Cookies thus the Properties referencing cookies are marked as not supported. Will close for now. If someone sees this in error please reopen. |
is it not possible to set cookie header @kjpou1 ? From the link it seems like headers can be passed in...? |
You can set some custom headers but not for cookies, they are handled entirely by the browser. You can only tell the browser to include them by setting the Also sending custom headers only works partially when doing cross domain requests. Browser specific settings like including credentials (aka cookies) in cross domain requests can be set via these methods: |
Thanks for the follow up @campersau |
Describe the bug
Trying to use an HttpClientHandler in blazor results in:
or
To Reproduce
You can also try with the Tweetinvi library that intensively use custom HttpClientHandlers
dotnet add package TweetinviApi -v 5.0.0-alpha-8
Exceptions (if any)
Further technical details
Microsoft.AspNetCore.Blazor : Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
dotnet --info
The text was updated successfully, but these errors were encountered: