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

Commit 783a74f

Browse files
committed
Revert "Remove fallback"
This reverts commit cb37c11.
1 parent 9045a4c commit 783a74f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/CorsServiceProvider.php

+7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ public function boot()
3535
} elseif ($this->app instanceof LumenApplication) {
3636
$this->app->configure('cors');
3737
}
38+
39+
// Add the headers on the Request Handled event as fallback in case of exceptions
40+
if (class_exists(RequestHandled::class) && $this->app->bound('events')) {
41+
$this->app->make('events')->listen(RequestHandled::class, function (RequestHandled $event) {
42+
$this->app->make(HandleCors::class)->onRequestHandled($event);
43+
});
44+
}
3845
}
3946

4047
/**

0 commit comments

Comments
 (0)