Remove Access Token usage

pull/40/head
nikolai-frolov 3 years ago
parent 8e2a68893f
commit e98e069ca6

@ -1,6 +1,5 @@
param ( param (
[Parameter(Mandatory)][string] $ManifestPath, [Parameter(Mandatory)][string] $ManifestPath
[string] $AccessToken
) )
$Global:validationFailed = $false $Global:validationFailed = $false
@ -10,7 +9,7 @@ function Publish-Error {
[string] $ErrorDescription, [string] $ErrorDescription,
[object] $Exception [object] $Exception
) )
Write-Output "::error ::$ErrorDescription" Write-Output "::error ::$ErrorDescription"
if (-not [string]::IsNullOrEmpty($Exception)) if (-not [string]::IsNullOrEmpty($Exception))
{ {
@ -20,12 +19,11 @@ function Publish-Error {
} }
function Test-DownloadUrl { function Test-DownloadUrl {
param([string] $DownloadUrl) param(
[string] $DownloadUrl
)
$request = [System.Net.WebRequest]::Create($DownloadUrl) $request = [System.Net.WebRequest]::Create($DownloadUrl)
if ($AccessToken) {
$authorizationHeaderValue = "Basic $AccessToken"
$request.Headers.Add("Authorization", $authorizationHeaderValue)
}
try { try {
$response = $request.GetResponse() $response = $request.GetResponse()
return ([int]$response.StatusCode -eq 200) return ([int]$response.StatusCode -eq 200)

Loading…
Cancel
Save