Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions ServiceNow/Private/Invoke-ServiceNowRestMethod.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,6 @@ function Invoke-ServiceNowRestMethod {
$params.Body = [System.Text.Encoding]::UTf8.GetBytes($Body)
}

# if ( $Body ) {
# $params.Body = $Body
# }

# Write-Verbose ($params | ConvertTo-Json)

# hide invoke-webrequest progress
$oldProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
Expand Down
11 changes: 11 additions & 0 deletions ServiceNow/Public/New-ServiceNowSession.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Use GraphQL instead of REST calls
.PARAMETER GetAllTable
Populate $ServiceNowTable with data from all tables the user has access to

.PARAMETER TimeoutSec
Timeout in seconds for all operations.
The default is 0 which represents no timeout.

.PARAMETER PassThru
Provide the resulting session object to the pipeline as opposed to setting as a script scoped variable to be used by default for other calls.
This is useful if you want to have multiple sessions with different api versions, credentials, etc.
Expand Down Expand Up @@ -119,6 +123,10 @@ function New-ServiceNowSession {
[Parameter()]
[switch] $GraphQL,

[Parameter()]
[ValidateRange(0, [int32]::MaxValue)]
[int32] $TimeoutSec = 0,

[Parameter()]
[switch] $PassThru
)
Expand Down Expand Up @@ -148,6 +156,9 @@ function New-ServiceNowSession {
}
}

$script:PSDefaultParameterValues['Invoke-WebRequest:TimeoutSec'] = $TimeoutSec
$script:PSDefaultParameterValues['Invoke-RestMethodt:TimeoutSec'] = $TimeoutSec

switch -Wildcard ($PSCmdLet.ParameterSetName) {
'OAuth*' {
$params = @{
Expand Down