-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix manual token creation with plain permalinks #6
Fix manual token creation with plain permalinks #6
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: |
@@ -107,7 +111,16 @@ public function test_init() { | |||
* @covers ::get_rest_uri() | |||
*/ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/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_url
API 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.