noodlehaus/dispatch

Seems url parameters break routes

bmcminn opened this issue · 3 comments

Trying to add url arguments to a route, and it breaks the route handling.

<?php
  // http://localhost:3005/login?wafklds > works
  // http://localhost:3005/login?wafklds=wjdfkls > doesn't work

  map('GET', BASE_URL.'/login', function() {
    echo 'login';
  });

hi @bmcminn. i tried the following code and it worked for me.

<?php
require __DIR__.'/dispatch.php';

map("GET", "/query", function () {
  var_dump($_GET);
});

dispatch();

then with curl.

> GET /query?name=noodlehaus HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:3000
> Accept: */*
> 
< HTTP/1.1 200 OK
< Host: localhost:3000
< Connection: close
< X-Powered-By: PHP/5.5.24
< Content-type: text/html
< 
array(1) {
  ["name"]=>
  string(4) "noodlehaus"
}

Just validated your source as well, so I'm thinking this may be something in my app that's causing an issue. Will follow up later this evening and close out if I figure it out.

Alright, determined the value of my BASE_URL constant was not processing REQUEST_URI properly and appended the query string to the route name in question. So theoretically my route never matched up as a result. My bad :P