Skip to content

Commit

Permalink
Set contexts PerPage value in API call if not provided in request body
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Dec 14, 2024
1 parent 6816fad commit a6603a9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/functions/public/API/Invoke-GitHubAPI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@
if ($Body) {
# Use body to create the query string for certain situations
if ($Method -eq 'GET') {
# If body conatins 'per_page' and its is null, set it to $context.PerPage
if ($Body.ContainsKey('per_page') -and $null -eq $Body['per_page']) {
$Body['per_page'] = $Context.PerPage
}
$queryString = $Body | ConvertTo-QueryString
$APICall.Uri = $APICall.Uri + $queryString
} elseif ($Body -is [string]) {
Expand Down

0 comments on commit a6603a9

Please sign in to comment.