@@ -200,6 +200,10 @@ function Invoke-GHRestMethod
200
200
$bodyAsBytes = [System.Text.Encoding ]::UTF8.GetBytes($Body )
201
201
$params.Add (" Body" , $bodyAsBytes )
202
202
Write-Log - Message " Request includes a body." - Level Verbose
203
+ if (Get-GitHubConfiguration - Name LogRequestBody)
204
+ {
205
+ Write-Log - Message $Body - Level Verbose
206
+ }
203
207
}
204
208
205
209
[Net.ServicePointManager ]::SecurityProtocol= [Net.SecurityProtocolType ]::Tls12
@@ -217,7 +221,7 @@ function Invoke-GHRestMethod
217
221
if ($PSCmdlet.ShouldProcess ($jobName , " Start-Job" ))
218
222
{
219
223
[scriptblock ]$scriptBlock = {
220
- param ($Url , $Method , $Headers , $Body , $ValidBodyContainingRequestMethods , $TimeoutSec , $ScriptRootPath )
224
+ param ($Url , $Method , $Headers , $Body , $ValidBodyContainingRequestMethods , $TimeoutSec , $LogRequestBody , $ ScriptRootPath )
221
225
222
226
# We need to "dot invoke" Helpers.ps1 and GitHubConfiguration.ps1 within
223
227
# the context of this script block since we're running in a different
@@ -239,6 +243,10 @@ function Invoke-GHRestMethod
239
243
$bodyAsBytes = [System.Text.Encoding ]::UTF8.GetBytes($Body )
240
244
$params.Add (" Body" , $bodyAsBytes )
241
245
Write-Log - Message " Request includes a body." - Level Verbose
246
+ if ($LogRequestBody )
247
+ {
248
+ Write-Log - Message $Body - Level Verbose
249
+ }
242
250
}
243
251
244
252
try
@@ -272,7 +280,15 @@ function Invoke-GHRestMethod
272
280
}
273
281
}
274
282
275
- $null = Start-Job - Name $jobName - ScriptBlock $scriptBlock - Arg @ ($url , $Method , $headers , $Body , $ValidBodyContainingRequestMethods , (Get-GitHubConfiguration - Name WebRequestTimeoutSec), $PSScriptRoot )
283
+ $null = Start-Job - Name $jobName - ScriptBlock $scriptBlock - Arg @ (
284
+ $url ,
285
+ $Method ,
286
+ $headers ,
287
+ $Body ,
288
+ $ValidBodyContainingRequestMethods ,
289
+ (Get-GitHubConfiguration - Name WebRequestTimeoutSec),
290
+ (Get-GitHubConfiguration - Name LogRequestBody),
291
+ $PSScriptRoot )
276
292
277
293
if ($PSCmdlet.ShouldProcess ($jobName , " Wait-JobWithAnimation" ))
278
294
{
0 commit comments