File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
src/Roots/Acorn/Application/Concerns Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,8 @@ protected function registerDefaultRoute(): void
156
156
$ response ->header ('X-Powered-By ' , $ this ->version ());
157
157
}
158
158
159
+ $ response ->setStatusCode (http_response_code ());
160
+
159
161
$ content = '' ;
160
162
161
163
$ levels = ob_get_level ();
@@ -194,13 +196,6 @@ protected function registerRequestHandler(
194
196
return ;
195
197
}
196
198
197
- if (
198
- $ isApi = Str::startsWith ($ path , $ api ) &&
199
- redirect_canonical (null , false )
200
- ) {
201
- return ;
202
- }
203
-
204
199
add_filter ('do_parse_request ' , function ($ condition , $ wp , $ params ) use ($ route ) {
205
200
if (! $ route ) {
206
201
return $ condition ;
@@ -215,9 +210,15 @@ protected function registerRequestHandler(
215
210
return ;
216
211
}
217
212
218
- $ config = $ this ->config ->get ('router.wordpress ' , ['web ' => 'web ' , 'api ' => 'api ' ]);
213
+ if (redirect_canonical (null , false )) {
214
+ return ;
215
+ }
216
+
217
+ $ middleware = Str::startsWith ($ path , $ api )
218
+ ? $ this ->config ->get ('router.wordpress.api ' , 'api ' )
219
+ : $ this ->config ->get ('router.wordpress.web ' , 'web ' );
219
220
220
- $ route ->middleware ($ isApi ? $ config [ ' api ' ] : $ config [ ' web ' ] );
221
+ $ route ->middleware ($ middleware );
221
222
222
223
ob_start ();
223
224
You can’t perform that action at this time.
0 commit comments