content-type fix

This commit is contained in:
Arnike
2022-12-17 01:11:05 +03:00
parent ea9b760933
commit 0913fc2069
2 changed files with 8 additions and 9 deletions

View File

@@ -27,22 +27,20 @@ function Invoke-Request {
if ($_tokenStatus -eq "Expired") { Update-Session } if ($_tokenStatus -eq "Expired") { Update-Session }
$_uri = "$($script:psipamSession.URL)/api/$($script:psipamSession.AppID)/$Controller" $_uri = "$($script:psipamSession.URL)/api/$($script:psipamSession.AppID)/$Controller"
if ($SubController -ne $null) { $_uri += "/$SubController" } if ($null -ne $SubController) { $_uri += "/$SubController" }
if ($Identifiers -ne $null) { $_uri += "/$($Identifiers -join '/')/" } if ($null -ne $Identifiers) { $_uri += "/$($Identifiers -join '/')/" }
$_headers = @{ $_headers = @{ }
"Accept" = "application/json"
"Content-Type" = "application/json"
}
switch ($script:psipamSession.AuthType) { switch ($script:psipamSession.AuthType) {
"Credentials" { $_headers.Add("token", $script:psipamSession.Token) } "Credentials" { $_headers.Add("token", $script:psipamSession.Token) }
"Token" { $_headers.Add("phpipam-token", $script:psipamSession.Token) } "Token" { $_headers.Add("phpipam-token", $script:psipamSession.Token) }
} }
$_arguments = @{ $_arguments = @{
Method = $Method Method = $Method
Uri = $_uri Uri = $_uri
Headers = $_headers Headers = $_headers
ContentType = "application/json"
} }
if ($Method -eq "POST" -or $Method -eq "PATCH") { if ($Method -eq "POST" -or $Method -eq "PATCH") {

View File

@@ -107,5 +107,6 @@ function New-Session {
break break
} }
} }
return $script:psipamSession
} }
Export-ModuleMember -Function New-Session Export-ModuleMember -Function New-Session