-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Global app middlewares and multiple action methods""
- Loading branch information
Petr Hejna
authored and
Petr Hejna
committed
Oct 1, 2018
1 parent
3f961ed
commit 24cc28c
Showing
6 changed files
with
131 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace BrandEmbassyTest\Slim\Dummy; | ||
|
||
use BrandEmbassy\Slim\Middleware; | ||
use BrandEmbassy\Slim\Request\RequestInterface; | ||
use BrandEmbassy\Slim\Response\ResponseInterface; | ||
|
||
class AllRouteMiddleware implements Middleware | ||
{ | ||
|
||
/** | ||
* @param RequestInterface $request | ||
* @param ResponseInterface $response | ||
* @param callable $next | ||
* @return ResponseInterface | ||
*/ | ||
public function __invoke(RequestInterface $request, ResponseInterface $response, callable $next) | ||
{ | ||
$response = $response->withAddedHeader('processed-by-all-route-middleware', 'correct'); | ||
|
||
return $next($request, $response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace BrandEmbassyTest\Slim\Dummy; | ||
|
||
use BrandEmbassy\Slim\Middleware; | ||
use BrandEmbassy\Slim\Request\RequestInterface; | ||
use BrandEmbassy\Slim\Response\ResponseInterface; | ||
|
||
class AppMiddleware implements Middleware | ||
{ | ||
|
||
/** | ||
* @param RequestInterface $request | ||
* @param ResponseInterface $response | ||
* @param callable $next | ||
* @return ResponseInterface | ||
*/ | ||
public function __invoke(RequestInterface $request, ResponseInterface $response, callable $next) | ||
{ | ||
$response = $response->withAddedHeader('processed-by-app-middleware', 'correct'); | ||
|
||
return $next($request, $response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters