REST API: Send a 500 status code when JSON encoding fails.
Previously, a 200 status code would be sent despite the 500 status code present in the response body. Props hermpheus, lalitjalandhar. Fixes #53056. Built from https://develop.svn.wordpress.org/trunk@51960 git-svn-id: http://core.svn.wordpress.org/trunk@51549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f76071026b
commit
af212ad9b3
|
@ -497,6 +497,7 @@ class WP_REST_Server {
|
|||
$json_error_message = $this->get_json_last_error();
|
||||
|
||||
if ( $json_error_message ) {
|
||||
$this->set_status( 500 );
|
||||
$json_error_obj = new WP_Error(
|
||||
'rest_encode_error',
|
||||
$json_error_message,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-51959';
|
||||
$wp_version = '5.9-alpha-51960';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue