[csharp-netcore] Make Blazor Webassembly compatible (#8876)

* Catch exception thrown in Blazor Webassembly when trying to access cookies

* Update samples
This commit is contained in:
Blackclaws
2021-03-06 08:50:48 +01:00
committed by GitHub
parent 65a31f1d9f
commit 85fd96a9ce
2 changed files with 12 additions and 6 deletions

View File

@@ -359,10 +359,13 @@ namespace {{packageName}}.Client
if (response != null)
{
foreach (Cookie cookie in handler.CookieContainer.GetCookies(uri))
{
transformed.Cookies.Add(cookie);
try {
foreach (Cookie cookie in handler.CookieContainer.GetCookies(uri))
{
transformed.Cookies.Add(cookie);
}
}
catch (PlatformNotSupportedException) {}
}
return transformed;

View File

@@ -347,10 +347,13 @@ namespace Org.OpenAPITools.Client
if (response != null)
{
foreach (Cookie cookie in handler.CookieContainer.GetCookies(uri))
{
transformed.Cookies.Add(cookie);
try {
foreach (Cookie cookie in handler.CookieContainer.GetCookies(uri))
{
transformed.Cookies.Add(cookie);
}
}
catch (PlatformNotSupportedException) {}
}
return transformed;