Adds function to securely read header values from our requests

This commit is contained in:
Christian Stein 2020-03-24 20:14:06 +01:00
parent 8d945f3759
commit 467f366c7c

View file

@ -0,0 +1,17 @@
function Get-IcingaRESTHeaderValue()
{
param(
[hashtable]$Request = @{},
[string]$Header = $null
);
if ($null -eq $Request -or [string]::IsNullOrEmpty($Header) -Or $Request.Count -eq 0) {
return $null;
}
if ($Request.Header.ContainsKey($Header) -eq $FALSE) {
return $null
}
return $Request.Header[$Header];
}