1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 05:07:36 +02:00

Revert "Switch HipChatHandler to API v2", fixes #525

This reverts commit 01549ec4d0.
This commit is contained in:
Jordi Boggiano
2015-03-09 09:51:58 +00:00
parent caa3145a14
commit d809f576bb
2 changed files with 5 additions and 4 deletions

View File

@@ -118,6 +118,7 @@ class HipChatHandler extends SocketHandler
{
$dataArray = array(
'from' => $this->name,
'room_id' => $this->room,
'notify' => $this->notify,
'message' => $record['formatted'],
'message_format' => $this->format,
@@ -135,7 +136,7 @@ class HipChatHandler extends SocketHandler
*/
private function buildHeader($content)
{
$header = "POST /v2/room/".$this->room."/notification?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: {$this->host}\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($content) . "\r\n";

View File

@@ -30,7 +30,7 @@ class HipChatHandlerTest extends TestCase
fseek($this->res, 0);
$content = fread($this->res, 1024);
$this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: api.hipchat.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
$this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: api.hipchat.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
return $content;
}
@@ -42,7 +42,7 @@ class HipChatHandlerTest extends TestCase
fseek($this->res, 0);
$content = fread($this->res, 1024);
$this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
$this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
return $content;
}
@@ -52,7 +52,7 @@ class HipChatHandlerTest extends TestCase
*/
public function testWriteContent($content)
{
$this->assertRegexp('/from=Monolog&notify=0&message=test1&message_format=text&color=red$/', $content);
$this->assertRegexp('/from=Monolog&room_id=room1&notify=0&message=test1&message_format=text&color=red$/', $content);
}
public function testWriteWithComplexMessage()