bug #40834 [Notifier] Microsoft Teams: JSON structure error fix for simple message (KamilKubicki)

This PR was merged into the 5.3-dev branch.

Discussion
----------

[Notifier] Microsoft Teams: JSON structure error fix for simple message

Code caused following error - 'Unable to post the Microsoft Teams message: ... Summary or Text is required. '. The structure of the message should contain the 'text' attribute instead of 'title'.

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix
| License       | MIT

Commits
-------

636dfc6b18 [Notifier] Microsoft Teams: JSON structure error fix for simple message
This commit is contained in:
Nyholm 2021-04-16 10:27:23 +02:00
commit d7007d7785
No known key found for this signature in database
GPG Key ID: D6332DE2B6F8FA38
2 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ final class MicrosoftTeamsTransport extends AbstractTransport
$endpoint = sprintf('https://%s%s', $this->getEndpoint(), $path);
$response = $this->client->request('POST', $endpoint, [
'json' => [
'title' => $message->getSubject(),
'text' => $message->getSubject(),
],
]);

View File

@ -79,7 +79,7 @@ final class MicrosoftTeamsTransportTest extends TransportTestCase
{
$message = 'testMessage';
$expectedBody = json_encode(['title' => $message]);
$expectedBody = json_encode(['text' => $message]);
$client = new MockHttpClient(function (string $method, string $url, array $options = []) use ($expectedBody): ResponseInterface {
$this->assertJsonStringEqualsJsonString($expectedBody, $options['body']);