Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Revert "Remove fallback"
Browse files Browse the repository at this point in the history
This reverts commit cb37c11.
  • Loading branch information
barryvdh committed Feb 23, 2022
1 parent 9045a4c commit 783a74f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/CorsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public function boot()
} elseif ($this->app instanceof LumenApplication) {
$this->app->configure('cors');
}

// Add the headers on the Request Handled event as fallback in case of exceptions
if (class_exists(RequestHandled::class) && $this->app->bound('events')) {
$this->app->make('events')->listen(RequestHandled::class, function (RequestHandled $event) {
$this->app->make(HandleCors::class)->onRequestHandled($event);
});
}
}

/**
Expand Down

0 comments on commit 783a74f

Please sign in to comment.