Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router shouldn't handle query parameters #27

Closed
piotr-cz opened this issue Apr 7, 2017 · 4 comments
Closed

Router shouldn't handle query parameters #27

piotr-cz opened this issue Apr 7, 2017 · 4 comments

Comments

@piotr-cz
Copy link

piotr-cz commented Apr 7, 2017

At this moment, URLs with query parameteres have to be defined as routes: /homescreen=1

In my opinion, a definition like / should work, but it doesn't.

@aheinze
Copy link
Member

aheinze commented Apr 7, 2017

hi,

sorry I don't get your intention. could you please give a more detailed example?

thanks!

@piotr-cz
Copy link
Author

piotr-cz commented Apr 7, 2017

Sure.
Let's say my URL is http://www.foobar.com/?homescreen=1.

and route definition is:

$app->get('/', function($params) use ($app) { die('Home'); });

The url is not matched by the route and I have to add special new one

$app->get('/?homescreen=1', function($params) use ($app) { die('Home'); });

IMHO the route definition should match. Then I'll be able to read query parameters with $app->param('homescreen', 0).

For example FastRoute recommends stripping query string from URI (PATH_INFO in case of Lime) in basic usage example

@aheinze
Copy link
Member

aheinze commented Apr 7, 2017

I see, but to be honest I wouldn't recommend to use the default route (using $_SERVER['PATH_INFO']) anyway.

But instead provide your own one which should be already filtered:

$app = new Lime\App([
    'route' => $route
]);

or

$app->run($route);

@piotr-cz
Copy link
Author

piotr-cz commented Apr 7, 2017

Thanks, I forgot it's possible to pass route manually to lime app

@piotr-cz piotr-cz closed this as completed Apr 7, 2017
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

No branches or pull requests

2 participants