From 93d78fb9d1bd22432450eadd3232fcde38a4b186 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 11 Jun 2018 17:09:35 +0100 Subject: [PATCH] download artifacts: disable header validation PowerShell now does extended header validation; disable this. --- download.build.artifacts.and.package.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/download.build.artifacts.and.package.ps1 b/download.build.artifacts.and.package.ps1 index d9c9b358..969e3261 100644 --- a/download.build.artifacts.and.package.ps1 +++ b/download.build.artifacts.and.package.ps1 @@ -6,6 +6,9 @@ Param( Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" +$PSDefaultParameterValues['Invoke-RestMethod:SkipHeaderValidation'] = $true +$PSDefaultParameterValues['Invoke-WebRequest:SkipHeaderValidation'] = $true + function Invoke-RestMethod-Ex($url, $downloadLocation) { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 @@ -29,7 +32,7 @@ function Invoke-RestMethod-Ex($url, $downloadLocation) { $irmParams.OutFile = "$downloadLocation" } - $output = Invoke-RestMethod @irmParams -ContentType "application/json" -Method "Get" -Uri "$url" + $output = Invoke-RestMethod @irmParams -Method "Get" -Uri "$url" if ($verbose) { Write-Host -ForegroundColor "Gray" "output = $(ConvertTo-Json $output)"