Restler icon indicating copy to clipboard operation
Restler copied to clipboard

Dashes in API URLs cause Resources->get to fail

Open shaneneuerburg opened this issue 12 years ago • 1 comments

In our API, we use dashes for API URLs that contain two words. For example, an API to perform CRUD operations on credit cards would have URLs like /api/credit-cards/.... This works for regular usage, but the Resources class sees the dash and tries to treat anything after it like a version.

See: https://github.com/Luracast/Restler/blob/master/vendor/Luracast/Restler/Resources.php#L190

Looking at the history of this section of the file, it appears that this was added as backwards compatibility in fix #141. Since the original usage was expecting a dash followed by 'v', a rough fix would be to change strpos to look for '-v'. This still breaks URLs that actually have '-v' in them unrelated to versions.

shaneneuerburg avatar Jan 15 '14 22:01 shaneneuerburg

Fixed in v3 branch

Arul- avatar Jan 16 '14 03:01 Arul-