Skip to content

Extend RouteCollectorProxy::redirect() to serve non-GET requests too#3430

Open
uhle wants to merge 1 commit intoslimphp:4.xfrom
uhle:redirect
Open

Extend RouteCollectorProxy::redirect() to serve non-GET requests too#3430
uhle wants to merge 1 commit intoslimphp:4.xfrom
uhle:redirect

Conversation

@uhle
Copy link

@uhle uhle commented Mar 20, 2026

While RouteCollectorProxy::redirect() is quite handy and useful, it only works for GET requests. Therefore I propose to extend it by another argument to set the accepted HTTP methods. Its default value should be ['GET'] so that legacy code can run unchanged. Then it would be possible to also use it like that:

$app->redirect('/books', '/library', 307, ['POST']);

@EmadAlmahdi
Copy link

This feels correct 👍

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.

2 participants