Skip to content

Commit 7cb6d38

Browse files
authored
Merge pull request #287 from Icinga:fix/http_requesttime_no_content
Fix: Invoke-IcingaCheckHTTPStatus RequestTime return value Fixes `Invoke-IcingaCheckHTTPStatus` which is not returning the request time, in case the target website is not providing content
2 parents ed06dee + 193282d commit 7cb6d38

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

doc/31-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1414
### Bugfixes
1515

1616
* [#283](https://github.com/Icinga/icinga-powershell-plugins/pull/283) Fixes random `Add-Type` exceptions during runtime compilation by replacing it with `Add-IcingaAddTypeLib`
17+
* [#286](https://github.com/Icinga/icinga-powershell-plugins/issues/286) Fixes `Invoke-IcingaCheckHTTPStatus` which is not returning the request time, in case the target website is not providing content
1718

1819
## 1.8.0 (2022-02-08)
1920

provider/http/Get-IcingaCheckHTTPQuery.psm1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ function Get-IcingaCheckHTTPQuery()
8989
$enc = [system.Text.Encoding]::UTF8;
9090
$HTTPData.Add('ContentSize', $enc.GetBytes($HTTPInformation.Content).Length);
9191
$HTTPData.Add('Content', $HTTPInformation.Content);
92-
$HTTPData.Add('RequestTime', (Get-IcingaTimer -Name 'HTTPRequest').Elapsed.TotalSeconds);
9392
} else {
9493
$HTTPData.Add('ContentSize', 0);
9594
}
9695

96+
$HTTPData.Add('RequestTime', (Get-IcingaTimer -Name 'HTTPRequest').Elapsed.TotalSeconds);
97+
9798
# Determine status code match
9899

99100
if ($StatusCode -contains $HTTPInformation.StatusCode) {

0 commit comments

Comments
 (0)