Private/GetProxySettingsForUri.ps1
function GetProxySettingsForUri { [CmdletBinding()] param ( [Parameter(Mandatory, Position = 0)] [string] $Uri ) if ([string]::IsNullOrWhiteSpace($Script:HttpProxy)) { return "" } if ($Uri -notmatch "://") { Write-Verbose "Assuming URI $Uri is an HTTPS URI since schema is missing..." $isHttps = $true } else { $isHttps = $Uri -match "https://" } if ($isHttps) { $proxy = $Script:HttpsProxy } else { $proxy = $Script:HttpProxy } return $proxy } # Copyright (c) 2023 AJ Tek Corporation. All Rights Reserved. |