diff --git a/modules/openapi-generator/src/main/resources/powershell/configuration.mustache b/modules/openapi-generator/src/main/resources/powershell/configuration.mustache index 0e674f1f560c..ffc9ca50d095 100644 --- a/modules/openapi-generator/src/main/resources/powershell/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/configuration.mustache @@ -173,8 +173,8 @@ function Set-{{{apiNamePrefix}}}Configuration { } If ($null -ne $Proxy) { - If ($Proxy.GetType().FullName -ne "System.Net.SystemWebProxy" -and $Proxy.GetType().FullName -ne "System.Net.WebRequest+WebProxyWrapperOpaque") { - throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must be System.Net.SystemWebProxy or System.Net.WebRequest+WebProxyWrapperOpaque." + If ('System.Net.IWebProxy' -notin $Proxy.GetType().ImplementedInterfaces.FullName) { + throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must implement System.Net.IWebProxy interface." } $Script:Configuration['Proxy'] = $Proxy } else { diff --git a/samples/client/echo_api/powershell/src/PSOpenAPITools/Client/Configuration.ps1 b/samples/client/echo_api/powershell/src/PSOpenAPITools/Client/Configuration.ps1 index 9e1aa107bbc1..baf8dbe0fd99 100644 --- a/samples/client/echo_api/powershell/src/PSOpenAPITools/Client/Configuration.ps1 +++ b/samples/client/echo_api/powershell/src/PSOpenAPITools/Client/Configuration.ps1 @@ -180,8 +180,8 @@ function Set-Configuration { } If ($null -ne $Proxy) { - If ($Proxy.GetType().FullName -ne "System.Net.SystemWebProxy" -and $Proxy.GetType().FullName -ne "System.Net.WebRequest+WebProxyWrapperOpaque") { - throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must be System.Net.SystemWebProxy or System.Net.WebRequest+WebProxyWrapperOpaque." + If ('System.Net.IWebProxy' -notin $Proxy.GetType().ImplementedInterfaces.FullName) { + throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must implement System.Net.IWebProxy interface." } $Script:Configuration['Proxy'] = $Proxy } else { diff --git a/samples/client/petstore/powershell/src/PSPetstore/Client/PSConfiguration.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Client/PSConfiguration.ps1 index d655e6f997b2..043b2f9e8464 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Client/PSConfiguration.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Client/PSConfiguration.ps1 @@ -179,8 +179,8 @@ function Set-PSConfiguration { } If ($null -ne $Proxy) { - If ($Proxy.GetType().FullName -ne "System.Net.SystemWebProxy" -and $Proxy.GetType().FullName -ne "System.Net.WebRequest+WebProxyWrapperOpaque") { - throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must be System.Net.SystemWebProxy or System.Net.WebRequest+WebProxyWrapperOpaque." + If ('System.Net.IWebProxy' -notin $Proxy.GetType().ImplementedInterfaces.FullName) { + throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must implement System.Net.IWebProxy interface." } $Script:Configuration['Proxy'] = $Proxy } else {