WordPress.org

Make WordPress Core

Ticket #43691: 43691-2.diff

File 43691-2.diff, 740 bytes (added by andizer, 2 years ago)

Remove the 410, 451 types which actually can have a body.

  • src/wp-includes/rest-api/class-wp-rest-server.php

     
    401401                         */
    402402                        $result = apply_filters( 'rest_pre_echo_response', $result, $this, $request );
    403403
     404                        // The 204 response shouldn't have a body.
     405                        if ( $code === 204 ) {
     406                                return null;
     407                        }
     408
     409                        if ( $result === null ) {
     410                                _doing_it_wrong( __FUNCTION__, __( 'The response doesn\'t contain a body, which was expected to be there.' ), '5.3' );
     411                        }
     412
    404413                        $result = wp_json_encode( $result );
    405414
    406415                        $json_error_message = $this->get_json_last_error();