mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2025-02-06 08:19:25 +03:00
Merge pull request #90 from z38/fix-webhook-notices
Fix notices on empty webhook requests
This commit is contained in:
commit
341e06a196
@ -91,6 +91,9 @@ class Mailgun{
|
||||
if($postData === null) {
|
||||
$postData = $_POST;
|
||||
}
|
||||
if(!isset($postData['timestamp']) || !isset($postData['token']) || !isset($postData['signature'])) {
|
||||
return false;
|
||||
}
|
||||
$hmac = hash_hmac('sha256', "{$postData["timestamp"]}{$postData["token"]}", $this->apiKey);
|
||||
$sig = $postData['signature'];
|
||||
if(function_exists('hash_equals')) {
|
||||
|
@ -33,4 +33,10 @@ class MailgunTest extends \Mailgun\Tests\MailgunTestCase
|
||||
);
|
||||
assert(!$client->verifyWebhookSignature($postData));
|
||||
}
|
||||
|
||||
public function testVerifyWebhookEmptyRequest() {
|
||||
$client = new Mailgun('key-3ax6xnjp29jd6fds4gc373sgvjxteol0');
|
||||
$postData = array();
|
||||
assert(!$client->verifyWebhookSignature($postData));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user