8000 [Notifier] Fix 3 errors for bridge Mattermost · symfony/symfony@ca9439a · GitHub
[go: up one dir, main page]

Skip to content

Commit ca9439a

Browse files
Sébastien COURJEANfabpot
Sébastien COURJEAN
authored andcommitted
[Notifier] Fix 3 errors for bridge Mattermost
1 parent 71b3912 commit ca9439a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransport.php

Lines changed 8000 : 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function doSend(MessageInterface $message): void
5656
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
5757
}
5858

59-
$endpoint = sprintf('https://%s/api/v4/post', $this->getEndpoint());
59+
$endpoint = sprintf('https://%s/api/v4/posts', $this->getEndpoint());
6060

6161
$options = ($opts = $message->getOptions()) ? $opts->toArray() : [];
6262
$options['message'] = $message->getSubject();
@@ -65,11 +65,11 @@ protected function doSend(MessageInterface $message): void
6565
$options['channel_id'] = $message->getRecipientId() ?: $this->channel;
6666
}
6767
$response = $this->client->request('POST', $endpoint, [
68-
'bearer' => $this->token,
68+
'auth_bearer' => $this->token,
6969
'json' => array_filter($options),
7070
]);
7171

72-
if (200 !== $response->getStatusCode()) {
72+
if (201 !== $response->getStatusCode()) {
7373
$result = $response->toArray(false);
7474

7575
throw new TransportException(sprintf('Unable to post the Mattermost message: %s (%s).', $result['message'], $result['id']), $response);

0 commit comments

Comments
 (0)
0