[wp-trac] [WordPress Trac] #53056: REST API json_encode error returns 500 data->status in body(Correct) but 200 in actual status(Incorrect).

WordPress Trac noreply at wordpress.org
Mon Apr 19 04:18:24 UTC 2021


#53056: REST API json_encode error returns 500 data->status in body(Correct) but
200 in actual status(Incorrect).
----------------------------+-----------------------------
 Reporter:  lalitjalandhar  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  General         |    Version:
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 {{{#!php
 <?php
 add_action( 'rest_api_init', function() {
         register_rest_route(
                 'v3',
                 '/my-custom-route',
                 array(
                         array(
                                 'methods'             =>
 \WP_REST_Server::READABLE,
                                 'callback'            => function() {
                                         return new \WP_REST_Response(INF);
                                 },
                                 'permission_callback' => '__return_true',
                                 'args'                => array(),
                         ),
                 )
         );
 });
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53056>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list