Adds support for API arguments without value

This commit is contained in:
Christian Stein 2020-03-27 17:53:29 +01:00
parent 0081641bd6
commit 9a2f3cd429

View file

@ -40,13 +40,17 @@ function Read-IcingaRESTMessage()
$ArgumentsSplit = $Arguments.Split('&');
$ArgumentsSplit+='\\\\\\\\\\\\=FIN';
foreach ( $Argument in $ArgumentsSplit | Sort-Object -descending) {
$Argument -match '(.+)=(.+)' | Out-Null;
If (($Matches[1] -ne $Current) -And ($NULL -ne $Current)) {
$Request.RequestArguments.Add( $Current, $ArgumentContent );
[array]$ArgumentContent = $null;
if ($Argument.Contains('=')) {
$Argument -match '(.+)=(.+)' | Out-Null;
If (($Matches[1] -ne $Current) -And ($NULL -ne $Current)) {
$Request.RequestArguments.Add( $Current, $ArgumentContent );
[array]$ArgumentContent = $null;
}
$Current = $Matches[1];
[array]$ArgumentContent += ($Matches[2]);
} else {
$Request.RequestArguments.Add( $Argument, $null );
}
$Current = $Matches[1];
[array]$ArgumentContent += ($Matches[2]);
}
# Header