Skip to content

Commit 28c3abe

Browse files
committed
fixed request body must be json error
1 parent ce2f905 commit 28c3abe

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/Exceptions/CouldNotSendNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static function serviceRespondsNotSuccessful(mixed $response): CouldNotSe
1111
if (isset($response->error)) {
1212
return new static("Couldn't post notification. Response: ".$response->error);
1313
}
14-
14+
1515
$responseBody = print_r($response->errors[0]->message, true);
1616

1717
return new static("Couldn't post notification. Response: ".$responseBody);

src/TwitterChannel.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ public function send($notifiable, Notification $notification): array|object
3737
$requestBody,
3838
$twitterMessage->isJsonRequest,
3939
);
40-
41-
if ($this->twitter->getLastHttpCode() !== 200) {
40+
41+
if ($this->twitter->getLastHttpCode() !== 201) {
4242
throw CouldNotSendNotification::serviceRespondsNotSuccessful($this->twitter->getLastBody());
4343
}
4444

45+
dd($twitterApiResponse);
4546
return $twitterApiResponse;
4647
}
4748

src/TwitterMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
abstract class TwitterMessage
66
{
7-
public bool $isJsonRequest = false;
7+
public bool $isJsonRequest = true;
88

99
public function __construct(protected string $content)
1010
{

src/TwitterServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function boot()
2222
config('services.twitter.access_secret')
2323
);
2424
$connection->setApiVersion('2');
25-
25+
2626
return $connection;
2727
});
2828
}

0 commit comments

Comments
 (0)