Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Aug 11, 2024
1 parent 8ee56ed commit 5713ed8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tests/GitHub.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,28 @@ Describe 'GitHub' {
}

It 'Can be called directly to get ratelimits' {
$ApiBaseUri = Get-GitHubConfig -Name ApiBaseUri
$ApiEndpoint = '/rate_limit'
$Method = 'GET'
$headers = @{
Accept = $Accept
'X-GitHub-Api-Version' = $Version
Accept = 'application/vnd.github+json; charset=utf-8'
'X-GitHub-Api-Version' = Get-GitHubConfig -Name ApiVersion
}

Remove-HashtableEntry -Hashtable $headers -NullOrEmptyValues

$ApiBaseUri = Get-GitHubConfig -Name ApiBaseUri
$ApiEndpoint = '/rate_limit'
$URI = ("$ApiBaseUri/" -replace '/$', '') + ("/$ApiEndpoint" -replace '^/', '')

$APICallStatusCode = $null
$APICallResponseHeaders = $null

$APICall = @{
Uri = $URI
Method = $Method
Method = 'GET'
Headers = $Headers
Authentication = 'Bearer'
Token = $AccessToken
ContentType = $ContentType
FollowRelLink = $FollowRelLink
Token = Get-GitHubConfig -Name AccessToken
ContentType = 'application/vnd.github+json; charset=utf-8'
FollowRelLink = $true
StatusCodeVariable = 'APICallStatusCode'
ResponseHeadersVariable = 'APICallResponseHeaders'
InFile = $UploadFilePath
Expand All @@ -55,7 +54,7 @@ Describe 'GitHub' {

#If PSversion is higher than 7.1 use HttpVersion
if ($PSVersionTable.PSVersion -ge [version]'7.3') {
$APICall['HttpVersion'] = $HttpVersion
$APICall['HttpVersion'] = [version]'2.0'
}

$APICall | Remove-HashtableEntry -NullOrEmptyValues
Expand Down

0 comments on commit 5713ed8

Please sign in to comment.