1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 18:16:10 +02:00

Use custom host in header as well

This commit is contained in:
Jordi Boggiano
2014-12-30 10:13:33 +00:00
parent 1fbe8c2641
commit 46825bdb95

View File

@@ -62,6 +62,11 @@ class HipChatHandler extends SocketHandler
*/ */
private $format; private $format;
/**
* @var string
*/
private $host;
/** /**
* @param string $token HipChat API Token * @param string $token HipChat API Token
* @param string $room The room that should be alerted of the message (Id or Name) * @param string $room The room that should be alerted of the message (Id or Name)
@@ -87,6 +92,7 @@ class HipChatHandler extends SocketHandler
$this->notify = $notify; $this->notify = $notify;
$this->room = $room; $this->room = $room;
$this->format = $format; $this->format = $format;
$this->host = $host;
} }
/** /**
@@ -131,7 +137,7 @@ class HipChatHandler extends SocketHandler
private function buildHeader($content) private function buildHeader($content)
{ {
$header = "POST /v1/rooms/message?format=json&auth_token=".$this->token." HTTP/1.1\r\n"; $header = "POST /v1/rooms/message?format=json&auth_token=".$this->token." HTTP/1.1\r\n";
$header .= "Host: api.hipchat.com\r\n"; $header .= "Host: {$this->host}\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($content) . "\r\n"; $header .= "Content-Length: " . strlen($content) . "\r\n";
$header .= "\r\n"; $header .= "\r\n";