Fix manual token creation with plain permalinks#6
Fix manual token creation with plain permalinks#6jkmassel wants to merge 6 commits intoWP-API:developfrom
Conversation
Uses the built-in `get_rest_url` API to handle all situations. Return only the path from `get_rest_uri`
|
The test is failing here, because the updated IMHO using absolute URIs is the way to go (otherwise how would subdomain multi-site installs work?), so I'd like to update the test. However, I'd love an explicit 👍 from a reviewer on that approach. |
a744bef to
1d4ae72
Compare
1d4ae72 to
21edd99
Compare
|
Hi @jkmassel sorry but I don't understand this PR. I currently have default permalinks set on the site I've been developing on, as a matter of fact, I have the entire time I've developed the plugin. I'm not sure I get what the intent is here because what you're saying is broken is working fine for me. I could only assume that there is something I'm either missing in the setup or you have a conflict from another active plugin. Could you explain the steps to reproduce the issue? I have edit: |
| */ | ||
| public function test_get_rest_uri() { | ||
| $this->assertEquals( '/wp-json/wp/v2/key-pair', WP_REST_Key_Pair::get_rest_uri() ); | ||
| $this->assertEquals( get_rest_url( null, '/wp/v2/key-pair' ), WP_REST_Key_Pair::get_rest_uri() ); |
There was a problem hiding this comment.
/wp/v2/key-pair is not a public API, it is meant for the user profile only.
5a350d8 to
a06359a
Compare
Yep that's right – sorry about the confusion. Updated the initial PR description to hopefully prevent future confusion. |
|
Closing in favour of #12 |
Uses the built-in
get_rest_urlAPI inside ofget_rest-uri– this results in permalink-style-aware URI generation.Fixes #4
To Test:
Before – set a site to use
defaultplain permalinks. Attempt to create a manual token. It should fail with a network error.After – set a site to use
defaultplain permalinks. Attempt to create a manual token. It should succeed.