Skip to content

Commit 69a3cba

Browse files
committed
Add function to check if request is auto refresh
Add a function to the Icinga Web Request that checks whether the request is sent by auto refresh by checking if the request header `X-Icinga-Autorefresh` is set.
1 parent fb58cb3 commit 69a3cba

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

library/Icinga/Web/Request.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
namespace Icinga\Web;
55

6-
use Icinga\Util\Json;
7-
use Zend_Controller_Request_Http;
86
use Icinga\Application\Icinga;
97
use Icinga\User;
8+
use Icinga\Util\Json;
9+
use Zend_Controller_Request_Http;
1010

1111
/**
1212
* A request
@@ -101,6 +101,16 @@ public function isApiRequest()
101101
return $this->getHeader('Accept') === 'application/json';
102102
}
103103

104+
/**
105+
* Get whether the request is sent by auto refresh
106+
*
107+
* @return bool
108+
*/
109+
public function isAutoRefresh(): bool
110+
{
111+
return $this->getHeader('X-Icinga-Autorefresh');
112+
}
113+
104114
/**
105115
* Makes an ID unique to this request, to prevent id collisions in different containers
106116
*

0 commit comments

Comments
 (0)