[DEVREL-29] allow pretty permalinks to be handled for rest endpoints by default #186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #178
Consolidates #181 into fewer commits
The linked issue is somewhat misrepresented. While the observed behavior is accurate (malformed URLs) it is not because of a misplaced
/wpin the REST url -- WP-API URLs on Bedrock-based sites are expected to have two/wp/strings in them -- one being the path to the application and the second is part of the actualwp-json/URL (e.g./wp-json/wp/v2/...). Therefore, the proposed solution would actually break sites without addressing the issue.Since the issue only exists on newly created sites, the assumption here is that these sites are not using "pretty permalinks". Indeed, our tests assume permalinks are pretty for this very reason. In cases when "pretty permalinks" are not active, it makes sense that API requests might fail due to our URL rewriting for internal paths.
This PR works around the issue by simply accepting "pretty"-style API endpoint paths while also preserving the functionality of "plain" permalinks. Both "plain" and "pretty" permalinks are henceforth supported by the REST API for WPCM sites.
Tests are broken out into #182 so as to not mix release and non-release commits and will fail until this PR is merged.Tests have been integrated back into this PR as well as other non-release changes. As a result, this PR MUST BE merged with a merge commit, not squash merge.