opened
tzfrs
username_0
I have the two following routes

    $router->map('POST'  , '/pages/[i:id]/posts/[i:postId]/comment/' ,'Comment#add');
    $router->map('GET'  , '/pages/[i:id]/posts/[i:postId]/comment/' ,'Comment#get');

When I'm now calling the first (POST) route without the trailing slash like this:

    /pages/1/posts/1/comment

Instead the get method is called. What can cause this behaviour? Is this a known issue? Is it reproducible?
Router reacts to GET method when POST route is called without trailing slash
issue
created
koenpunt
username_1
The first thing that is being checked when matching routes is the request method; https://github.com/username_2/AltoRouter/blob/master/AltoRouter.php#L192
So I guess it has something to do with other routes you might have defined?
comment
created
koenpunt
username_1
Or could it be that your server configuration adds slashes, which make the POST end up as GET
comment
created
dannyvankooten
username_2
A full list of your defined routes would be really helpful here @username_0
comment
closed
koenpunt
username_1
issue
created
koenpunt
username_1
Closing as stale. If your problem still exists please let me know and I'll reopen the issue.
comment