Skip to content

Commit

Permalink
Fix proxy type (#18166)
Browse files Browse the repository at this point in the history
* Update configuration.mustache

Fix check of proxy type

* Changing sample source files
  • Loading branch information
condorcorde committed Mar 20, 2024
1 parent 1108ce5 commit de081e4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit de081e4

Please sign in to comment.