[wp-trac] [WordPress Trac] #38873: REST API doesn't match with trailing slash when not using rewrites
WordPress Trac
noreply at wordpress.org
Sat Nov 19 18:34:05 UTC 2016
#38873: REST API doesn't match with trailing slash when not using rewrites
--------------------------+-----------------
Reporter: joehoyle | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.7
Component: REST API | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------
Current, a request to the API with rewrite rules enabled doesn't
differenentiate URLs with trailing slashes just as `http://localhost:8080
/wp-json/wp/v2/` vs `http://localhost:8080/wp-json/wp/v2`, this seems to
be a property to WP_Rewrite / class WP to split off the trailing slash
always.
However, when making requests do
`http://localhost:8080/?rest_route=/wp/v2/` the trailing slash is not
stripped, as it doesn't go through the same transformation in `class WP`.
I think it's safe to always untrailingslash the requested URL in the REST
API, for matching purposes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38873>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list