mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-11 23:54:04 +02:00
Fix SlackHandler
Slack API requires to json_encode the attachment field.
This commit is contained in:
committed by
Haralan Dobrev
parent
dd238892cf
commit
5fa5e37305
@@ -110,6 +110,10 @@ class SlackHandler extends SocketHandler
|
|||||||
$dataArray = $this->slackRecord->getSlackData($record);
|
$dataArray = $this->slackRecord->getSlackData($record);
|
||||||
$dataArray['token'] = $this->token;
|
$dataArray['token'] = $this->token;
|
||||||
|
|
||||||
|
if (!empty($dataArray['attachments'])) {
|
||||||
|
$dataArray['attachments'] = json_encode($dataArray['attachments']);
|
||||||
|
}
|
||||||
|
|
||||||
return $dataArray;
|
return $dataArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -99,7 +99,7 @@ class SlackHandlerTest extends TestCase
|
|||||||
fseek($this->res, 0);
|
fseek($this->res, 0);
|
||||||
$content = fread($this->res, 1024);
|
$content = fread($this->res, 1024);
|
||||||
|
|
||||||
$this->assertRegexp('/%5Bcolor%5D='.$expectedColor.'/', $content);
|
$this->assertRegexp('/%22color%22%3A%22'.$expectedColor.'/', $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWriteContentWithPlainTextMessage()
|
public function testWriteContentWithPlainTextMessage()
|
||||||
|
Reference in New Issue
Block a user