Skip to content

Commit

Permalink
Fix Auth header for PS Desktop (#4)
Browse files Browse the repository at this point in the history
* Fix Auth header for PS Desktop

* Show all Pester Steps

* Cast Retry header on Windows.
  • Loading branch information
RobFaie authored Jul 28, 2021
1 parent 46ccd66 commit eb18284
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions functions/Invoke-Method.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function Invoke-Method {
$params.Token = $Context.IntegrationKey.Password
} else {
# PS Desktop requires manual header creation.
$params.Headers.Bearer = $Context.IntegrationKey.GetNetworkCredential().Password
$params.Headers.Authorization = 'Bearer ' + $Context.IntegrationKey.GetNetworkCredential().Password
}

if ($PSBoundParameters.ContainsKey('Body')) {
Expand Down Expand Up @@ -129,7 +129,7 @@ function Invoke-Method {
$retryAfter = 5
if ($errorRecord.Exception -is [System.Net.WebException]) {
if ($response.Headers['Retry-After']) {
$retryAfter = $response.Headers['Retry-After']
$retryAfter = $response.Headers['Retry-After'] -as [Int]
}
} else {
if ($response.Headers.RetryAfter) {
Expand Down
6 changes: 5 additions & 1 deletion test-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ steps:
Import-Module -Name './Pester/*/Pester.psd1'
Get-Module Pester | Format-Table Name, Version | Out-String
Set-Location -Path '$(Pipeline.Workspace)'
Invoke-Pester -CI
$config = [PesterConfiguration]::Default
$config.TestResult.Enabled = $true
$config.Run.Exit = $true
$config.Output.Verbosity = 'Detailed'
Invoke-Pester -Configuration $config
Get-ChildItem *.xml | Out-String
- task: PublishTestResults@2
condition: succeededOrFailed()
Expand Down

0 comments on commit eb18284

Please sign in to comment.