content-type fix
This commit is contained in:
@@ -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") {
|
||||||
|
|||||||
@@ -107,5 +107,6 @@ function New-Session {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $script:psipamSession
|
||||||
}
|
}
|
||||||
Export-ModuleMember -Function New-Session
|
Export-ModuleMember -Function New-Session
|
||||||
Reference in New Issue
Block a user