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 }
$_uri = "$($script:psipamSession.URL)/api/$($script:psipamSession.AppID)/$Controller"
if ($SubController -ne $null) { $_uri += "/$SubController" }
if ($Identifiers -ne $null) { $_uri += "/$($Identifiers -join '/')/" }
if ($null -ne $SubController) { $_uri += "/$SubController" }
if ($null -ne $Identifiers) { $_uri += "/$($Identifiers -join '/')/" }
$_headers = @{
"Accept" = "application/json"
"Content-Type" = "application/json"
}
$_headers = @{ }
switch ($script:psipamSession.AuthType) {
"Credentials" { $_headers.Add("token", $script:psipamSession.Token) }
"Token" { $_headers.Add("phpipam-token", $script:psipamSession.Token) }
}
$_arguments = @{
Method = $Method
Uri = $_uri
Headers = $_headers
Method = $Method
Uri = $_uri
Headers = $_headers
ContentType = "application/json"
}
if ($Method -eq "POST" -or $Method -eq "PATCH") {

View File

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