Closed m42e closed 5 years ago
I'm not sure it is correct too.
I have the following routes:
$r3->any('/places', '\Application\Endpoints\PlacesCollection'); $r3->any('/places/*', '\Application\Endpoints\PlacesObject');
What I expect is, when I call GET /places
, is the first route that should match. But it keeps matching the second route: /places/*. Causing my application an error, cause there is no id expected at the URI.
Are you sure this behavior is correct, @kpande ?
@kpande I'll submit one, this week.
Fixed sorting at 72cde63b78143b706011ed2e54c581705f107b71
Closed: This will work now.
Ok maybe it needed just a little more tweaking.
Since reported commit the new order as per the example:
GET /
POST /addresses
GET /addresses
GET /*
PATCH /addresses/*
DELETE /addresses/*
GET /addresses/*/mails
DELETE /addresses/*/*
GET /addresses/*/mails/*
DELETE /addresses/*/mails/*
DELETE /addresses/**
GET /**
The exact order of dissimilar paths are not that important, they get grouped on route matching, as long as the wildcards come last.
The following is also acceptable:
POST /addresses
GET /
GET /addresses
GET /*
...
A target lookup of /addresses
will have these matching routes, in order of preference:
POST /addresses
GET /addresses
GET /*
PATCH /addresses/*
DELETE /addresses/*
DELETE /addresses/**
GET /**
Hi,
I tried to create a router for the following routes:
But the sorting with the original sort algorithm went totally wrong which caused an Exception when I try to GET
/addresses/1/mails
because a parameter was missing for mail function.I got the following order:
What I expected:
Am I right? I have also prepared an algorithm that sorts in my expected order. Can someone please tell me if my expectation is correct?
Thank you