mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51960 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user