mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Adds function to securely read header values from our requests
This commit is contained in:
parent
8d945f3759
commit
467f366c7c
1 changed files with 17 additions and 0 deletions
17
lib/web/Get-IcingaRESTHeaderValue.psm1
Normal file
17
lib/web/Get-IcingaRESTHeaderValue.psm1
Normal 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];
|
||||
}
|
||||
Loading…
Reference in a new issue