File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,8 @@ protected function registerDefaultRoute(): void
218
218
$ response ->header ('X-Powered-By ' , $ this ->app ->version ());
219
219
}
220
220
221
+ $ response ->setStatusCode (http_response_code ());
222
+
221
223
$ content = '' ;
222
224
223
225
$ levels = ob_get_level ();
@@ -257,13 +259,6 @@ protected function registerRequestHandler(
257
259
return ;
258
260
}
259
261
260
- if (
261
- $ isApi = Str::startsWith ($ path , $ api ) &&
262
- redirect_canonical (null , false )
263
- ) {
264
- return ;
265
- }
266
-
267
262
add_filter ('do_parse_request ' , function ($ condition , $ wp , $ params ) use ($ route ) {
268
263
if (! $ route ) {
269
264
return $ condition ;
@@ -282,9 +277,15 @@ protected function registerRequestHandler(
282
277
return ;
283
278
}
284
279
285
- $ config = $ this ->app ->config ->get ('router.wordpress ' , ['web ' => 'web ' , 'api ' => 'api ' ]);
280
+ if (redirect_canonical (null , false )) {
281
+ return ;
282
+ }
283
+
284
+ $ middleware = Str::startsWith ($ path , $ api )
285
+ ? $ this ->app ->config ->get ('router.wordpress.api ' , 'api ' )
286
+ : $ this ->app ->config ->get ('router.wordpress.web ' , 'web ' );
286
287
287
- $ route ->middleware ($ isApi ? $ config [ ' api ' ] : $ config [ ' web ' ] );
288
+ $ route ->middleware ($ middleware );
288
289
289
290
ob_start ();
290
291
You can’t perform that action at this time.
0 commit comments