mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fix codestyling
This commit is contained in:
parent
50133d22f2
commit
e6b46b84f7
1 changed files with 14 additions and 14 deletions
|
|
@ -4,8 +4,8 @@ function Read-IcingaRESTMessage()
|
||||||
[string]$RestMessage = $null
|
[string]$RestMessage = $null
|
||||||
);
|
);
|
||||||
|
|
||||||
[hashtable]$Request = @{}
|
[hashtable]$Request = @{};
|
||||||
$RestMessage -match '(\d+) (.+) (.+) (.+)' | Out-Null
|
$RestMessage -match '(\d+) (.+) (.+) (.+)' | Out-Null;
|
||||||
|
|
||||||
$Request.Add('MessageLength', $Matches[1]);
|
$Request.Add('MessageLength', $Matches[1]);
|
||||||
$Request.Add('Method', $Matches[2]);
|
$Request.Add('Method', $Matches[2]);
|
||||||
|
|
@ -14,31 +14,31 @@ function Read-IcingaRESTMessage()
|
||||||
$Request.Add('RequestArguments', @{});
|
$Request.Add('RequestArguments', @{});
|
||||||
|
|
||||||
#Path
|
#Path
|
||||||
$PathMatch = $Matches[3]
|
$PathMatch = $Matches[3];
|
||||||
$PathMatch -match '(.+)\?(.*)' | Out-Null
|
$PathMatch -match '(.+)\?(.*)' | Out-Null
|
||||||
$Path = $Matches[1]
|
$Path = $Matches[1];
|
||||||
$Arguments = $Matches[2]
|
$Arguments = $Matches[2];
|
||||||
$Request.RequestPath.Add('FullPath', $Matches[1]);
|
$Request.RequestPath.Add('FullPath', $Matches[1]);
|
||||||
$Request.RequestPath.Add('PathArray', $Matches[1].TrimStart('/').Split('/'));
|
$Request.RequestPath.Add('PathArray', $Matches[1].TrimStart('/').Split('/'));
|
||||||
|
|
||||||
$Matches = $null
|
$Matches = $null;
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
$ArgumentsSplit = $Arguments.Split('&')
|
$ArgumentsSplit = $Arguments.Split('&');
|
||||||
$ArgumentsSplit+='\\\\\\\\\\\\=FIN'
|
$ArgumentsSplit+='\\\\\\\\\\\\=FIN';
|
||||||
foreach ( $Argument in $ArgumentsSplit | sort -descending) {
|
foreach ( $Argument in $ArgumentsSplit | sort -descending) {
|
||||||
$Argument -match '(.+)=(.+)' | Out-Null
|
$Argument -match '(.+)=(.+)' | Out-Null;
|
||||||
If (($Matches[1] -ne $Current) -And ($NULL -ne $Current)) {
|
If (($Matches[1] -ne $Current) -And ($NULL -ne $Current)) {
|
||||||
$Request.RequestArguments.Add( $Current, $ArgumentContent );
|
$Request.RequestArguments.Add( $Current, $ArgumentContent );
|
||||||
[array]$ArgumentContent = $null
|
[array]$ArgumentContent = $null;
|
||||||
}
|
}
|
||||||
$Current = $Matches[1]
|
$Current = $Matches[1];
|
||||||
[array]$ArgumentContent+=($Matches[2]);
|
[array]$ArgumentContent+=($Matches[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
$Request.Add( 'Header', @{} );
|
$Request.Add( 'Header', @{} );
|
||||||
$SplitString = $RestMessage.split("`r`n")
|
$SplitString = $RestMessage.split("`r`n");
|
||||||
foreach ( $SingleString in $SplitString ) {
|
foreach ( $SingleString in $SplitString ) {
|
||||||
if ( ([string]::IsNullOrEmpty($SingleString) -eq $FALSE) -And ($SingleString -match '^{.+' -eq $FALSE) ) {
|
if ( ([string]::IsNullOrEmpty($SingleString) -eq $FALSE) -And ($SingleString -match '^{.+' -eq $FALSE) ) {
|
||||||
$SingleSplitString = $SingleString.Split(':',2);
|
$SingleSplitString = $SingleString.Split(':',2);
|
||||||
|
|
@ -48,10 +48,10 @@ function Read-IcingaRESTMessage()
|
||||||
|
|
||||||
$Request.Add('ContentLength', [int](Get-IcingaRESTHeaderValue -Header 'Content-Length' -Request $Request));
|
$Request.Add('ContentLength', [int](Get-IcingaRESTHeaderValue -Header 'Content-Length' -Request $Request));
|
||||||
|
|
||||||
$Matches = $null
|
$Matches = $null;
|
||||||
|
|
||||||
# Body
|
# Body
|
||||||
$RestMessage -match '(\{(.*\n)*}|\{.*\})' | Out-Null
|
$RestMessage -match '(\{(.*\n)*}|\{.*\})' | Out-Null;
|
||||||
$Request.Add('Body', $Matches[1]);
|
$Request.Add('Body', $Matches[1]);
|
||||||
|
|
||||||
return $Request;
|
return $Request;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue