From a4ae7fc1a3b6bb50fbf456d444b991fa1219ec0d Mon Sep 17 00:00:00 2001 From: Chris Breuer Date: Mon, 21 Dec 2020 17:26:52 -0800 Subject: [PATCH] fix: add middleware if it's not already declared --- src/Http/Middleware/VerifySignature.php | 6 ++++-- src/Providers/MediaConverterServiceProvider.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Http/Middleware/VerifySignature.php b/src/Http/Middleware/VerifySignature.php index 080c7ac..fe3d390 100644 --- a/src/Http/Middleware/VerifySignature.php +++ b/src/Http/Middleware/VerifySignature.php @@ -5,6 +5,7 @@ use Aws\Sns\Message; use Aws\Sns\MessageValidator; use Closure; +use Illuminate\Http\Client\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class VerifySignature @@ -12,15 +13,16 @@ class VerifySignature /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request + * @param Request $request * @param \Closure $next * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next) { try { // Create a message from the post data and validate its signature $message = Message::fromRawPostData(); + // Validate the message $validator = new MessageValidator(); diff --git a/src/Providers/MediaConverterServiceProvider.php b/src/Providers/MediaConverterServiceProvider.php index 6d5583d..87eb8f6 100644 --- a/src/Providers/MediaConverterServiceProvider.php +++ b/src/Providers/MediaConverterServiceProvider.php @@ -33,7 +33,7 @@ public function boot() $router = $this->app->make(Router::class); - if (in_array('verify-signature', $router->getMiddleware())) { + if (! in_array('verify-signature', $router->getMiddleware())) { $router->aliasMiddleware('verify-signature', VerifySignature::class); } }