This repository was archived by the owner on Jan 5, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public function boot(?bool $isConsole = false) : Upstart
5757 /**
5858 * Add cors to the request
5959 */
60- $ this ->addCors ();
60+ $ this ->addCors ($ isConsole );
6161
6262 /**
6363 * Don't load framework components, if
@@ -113,6 +113,9 @@ class_alias($class, $alias);
113113 */
114114 private function startApp (bool $ isConsole )
115115 {
116+ /**
117+ * Start the App Service Resolver
118+ */
116119 (new AppServiceResolver )->start (Application::prototype ($ isConsole ));
117120
118121 /**
Original file line number Diff line number Diff line change 55trait HandleCors
66{
77 /**
8- * add Cors
8+ * Add cors to request
99 *
10+ * @param bool $isConsole
1011 * @return void
1112 */
12- public function addCors ()
13+ public function addCors (bool $ isConsole = false )
1314 {
15+ /**
16+ * Don't add Cors if this is a console application.
17+ * Application might fail if this is a PHPUnit test
18+ */
19+ if ($ isConsole ) return ;
20+
21+ /**
22+ * This is not a console application, let's add
23+ * Cors!
24+ */
1425 header ('Access-Control-Allow-Credentials: 0 ' );
1526 header ('Access-Control-Allow-Origin: * ' );
1627 header ('Access-Control-Allow-Headers: * ' );
1728 header ('Access-Control-Allow-Methods: * ' );
1829
30+ /**
31+ * Let's exit if the request type is "options"
32+ */
1933 if (isset ($ _SERVER ["REQUEST_METHOD " ]) && $ _SERVER ["REQUEST_METHOD " ] === "OPTIONS " ) {
2034 exit ;
2135 }
2236 }
2337
2438 /**
25- * remove Cors
39+ * Remove cors to request
2640 *
2741 * @return void
2842 */
Original file line number Diff line number Diff line change 11{
22 "name" : " modulusphp/framework" ,
33 "description" : " Framework component for Modulus" ,
4- "version" : " 1.9.9.2 " ,
4+ "version" : " 1.9.9.3 " ,
55 "license" : " MIT" ,
66 "type" : " package" ,
77 "authors" : [{
You can’t perform that action at this time.
0 commit comments