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

Last router method with same name is overwrite previous with other http method #28

Closed
roquie opened this issue Oct 23, 2018 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@roquie
Copy link
Contributor

roquie commented Oct 23, 2018

How to reproduce?

<?php
// Setup server
$server = new HttpServer(new Configuration('0.0.0.0', 8080));
// Setup application and routes
$application = new HttpApplication();
$application->put('/user/{id}', function (ServerRequestInterface $request) : ResponseInterface {
    return Response::asText("updated");
});
$application->delete('/user/{id}', function (ServerRequestInterface $request) : ResponseInterface {
    return Response::asText("destroyed");
});
// Run the server, it should listen on localhost:8080
$application->run($server);

Two routes contains same name and latest route (with delete method) is overwrite the previous. This leads to the following error:

This uri `/user/5` allows only DELETE http methods.

It's a bug.

@dkraczkowski
Copy link
Contributor

@roquie Thanks for rising it, it will get fixed very soon.

@dkraczkowski dkraczkowski added the bug Something isn't working label Oct 23, 2018
@dkraczkowski dkraczkowski added this to the 2.0.1 milestone Oct 23, 2018
@roquie
Copy link
Contributor Author

roquie commented Oct 23, 2018

@dkraczkowski pls, accept the PR, igniphp/network#5

And draft new release for composer.

@dkraczkowski
Copy link
Contributor

Note: Seems like the problem is within the route naming, the routes get overridden because I am reusing the same name to register the route. I will need to tweak it a bit with help of currently used symfony router

@roquie
Copy link
Contributor Author

roquie commented Dec 3, 2018

It has done. Just merge PR as soon as possible.
igniphp/network#7

@dkraczkowski
Copy link
Contributor

@roquie Thanks for help with this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants