Skip to content

Commit

Permalink
#351 fixed New-RsRestCacheRefreshPlan for custom credentials (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
suyogkw authored Oct 12, 2021
1 parent 3788a72 commit eae2b76
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ function New-RsRestCacheRefreshPlan
$payloadJson = ConvertTo-Json $payload -Depth 15
Write-Verbose "Payload: $payloadJson"

$response = Invoke-RestMethod -Uri $refreshplansUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -UseDefaultCredentials -Verbose:$false
if ($Credential -ne $null)
{
$response = Invoke-WebRequest -Uri $refreshplansUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -Credential $Credential -Verbose:$false
}
else
{
$response = Invoke-WebRequest -Uri $refreshplansUri -Method Post -WebSession $WebSession -Body ([System.Text.Encoding]::UTF8.GetBytes($payloadJson)) -ContentType "application/json" -UseDefaultCredentials -Verbose:$false
}

Write-Verbose "Schedule payload for $RsItem was created successfully!"
return $response
Expand Down

0 comments on commit eae2b76

Please sign in to comment.