Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Conversation

@danielbachhuber
Copy link
Member

Routing requests through the server in a RESTful manner permits us to
de-couple controllers from one another, permitting subclassing, etc. It
also ensures all of the appropriate permission and validation checks are
run on each internal request.

See #1218

Routing requests through the server in a RESTful manner permits us to
de-couple controllers from one another, permitting subclassing, etc. It
also ensures all of the appropriate permission and validation checks are
run on each internal request.
@danielbachhuber
Copy link
Member Author

@WP-API/amigos How do you feel about this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if I could pass any arbitrary path, including one prepared with rest_url()

@joehoyle
Copy link
Member

joehoyle commented Jun 8, 2015

Per my Slack feedback, I'd like to see it return a WP_Error on an error response, so all my error checking code would be the same as other error checking code. For example:

$request = rest_do_requests( '/wp/v1/posts' );

if ( is_wp_error( $request ) ) {
    return $request;
}

danielbachhuber pushed a commit that referenced this pull request Jun 8, 2015
Introduce `rest_do_request()` for making REST requests internally
@danielbachhuber danielbachhuber merged commit 3035bdf into develop Jun 8, 2015
@danielbachhuber danielbachhuber deleted the 1218-do-rest-request branch June 8, 2015 23:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants