Skip to content

Conversation

@ycrao
Copy link

@ycrao ycrao commented Dec 25, 2025

fix return Bad Middleware when using class string name in router.

$router->group('', function(Router $router) use ($app) {

	$router->get('/', function() use ($app) {
		$app->render('welcome', ['message' => 'some message...']);
	});
}, [ SecurityHeadersMiddleware::class ]);

then run php runway routes in terminal.

before fix:

Routes
+----------------------------------------------+--------------------+-------+----------+----------------+
| Pattern                                      | Methods            | Alias | Streamed | Middleware     |
+----------------------------------------------+--------------------+-------+----------+----------------+
| /                                            | GET, HEAD, OPTIONS |       | No       | Bad Middleware |

after fix:

+----------------------------------------------+--------------------+-------+----------+------------------------------------------------+
| Pattern                                      | Methods            | Alias | Streamed | Middleware                                     |
+----------------------------------------------+--------------------+-------+----------+------------------------------------------------+
| /                                            | GET, HEAD, OPTIONS |       | No       | SecurityHeadersMiddleware                      |

fix return Bad Middleware when using class string name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant