Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #17 from frankvanhest/bug_error_when_routingmiddle…
Browse files Browse the repository at this point in the history
…ware_is_not_used

Use add method when RoutingMiddleware is not used
  • Loading branch information
ozee31 authored Jul 5, 2018
2 parents 37b1137 + 1cf22ee commit e59a78e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
*/
EventManager::instance()->on('Server.buildMiddleware',
function ($event, $middleware) {
$middleware->insertBefore(RoutingMiddleware::class, new CorsMiddleware());
try {
$middleware->insertBefore(RoutingMiddleware::class, new CorsMiddleware());
} catch (\LogicException $exception) {
$middleware->add(new CorsMiddleware());
}
}
);

0 comments on commit e59a78e

Please sign in to comment.