Skip to content

Commit 2b33282

Browse files
committed
fix: update post request to use new user agent
1 parent 57866f9 commit 2b33282

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Modules/CIPPCore/Public/GraphHelper/New-GraphPOSTRequest.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ function New-GraphPOSTRequest {
2727
$Headers = $Headers
2828
} else {
2929
$Headers = Get-GraphToken -tenantid $tenantid -scope $scope -AsApp $asapp -SkipCache $skipTokenCache
30-
$body = Get-CIPPTextReplacement -TenantFilter $tenantid -Text $body -EscapeForJson
3130
}
3231
if ($AddedHeaders) {
3332
foreach ($header in $AddedHeaders.GetEnumerator()) {
3433
$headers.Add($header.Key, $header.Value)
3534
}
3635
}
3736

37+
$body = Get-CIPPTextReplacement -TenantFilter $tenantid -Text $body -EscapeForJson
38+
3839
if (!$headers['User-Agent']) {
39-
$headers['User-Agent'] = "CIPP/$($env:CippVersion ?? '1.0')"
40+
$headers['User-Agent'] = Get-CippUserAgent
41+
Write-Information "User-Agent: $($headers['User-Agent'])"
4042
}
4143

4244
if (!$contentType) {

0 commit comments

Comments
 (0)