REST API: Deliver parameters unadulterated instead of slashed.

We goofed, and parameters accessed through the REST API's methods
were slashed (inconsistently, even). This unslashes the data, so
you get the un-messed-with data that was sent.

Props joehoyle.
Fixes #36419.

git-svn-id: https://develop.svn.wordpress.org/trunk@37163 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2016-04-06 21:01:11 +00:00
parent 28699803ee
commit 9deec9e723
3 changed files with 142 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ class Spy_REST_Server extends WP_REST_Server {
public $sent_headers = array();
public $sent_body = '';
public $last_request = null;
/**
* Get the raw $endpoints data from the server
@@ -29,6 +30,17 @@ class Spy_REST_Server extends WP_REST_Server {
$this->sent_headers[ $header ] = $value;
}
/**
* Override the dispatch method so we can get a handle on the request object.
*
* @param WP_REST_Request $request
* @return WP_REST_Response Response returned by the callback.
*/
public function dispatch( $request ) {
$this->last_request = $request;
return parent::dispatch( $request );
}
public function serve_request( $path = null ) {
ob_start();