Welcome Guest, Not a member yet? Register   Sign In
trailing slash misdirects resource controller

when specifying a resource route according to the user guide:
PHP Code:
the create() controller method is correctly called when POSTing data to /photos, however when a trailing slash is added /photos/ the index() controller method is called instead

adding a route like
PHP Code:
before the resource route doesn't help

This is because a URL ending with a trailing slash is treated as a directory, not a file.

This applies to all URLs in general, not only in API or CodeIgniter as a whole.


sorry, I don't see how it makes a POST request to /photos/ equivalent to a GET request to /photos in a REST resource. Seems like now I need to manually add a check if index() has been called with the incorrect method and return 404

Theme © iAndrew 2016 - Forum software by © MyBB