[wp-trac] [WordPress Trac] #39933: WP_REST_Request::get_param() doesn't work for getting body params on DELETE requests

WordPress Trac noreply at wordpress.org
Wed Feb 22 05:41:32 UTC 2017


#39933: WP_REST_Request::get_param() doesn't work for getting body params on DELETE
requests
--------------------------+-----------------------------
 Reporter:  mnelson4      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 You cannot pass a request body on DELETE requests, although it seems to be
 admissible (see http://stackoverflow.com/questions/299628/is-an-entity-
 body-allowed-for-an-http-delete-request), and when deleting posts it
 should be possible (eg you can provide a "force" argument, but it gets
 ignored unless it's included in the querystring.)

 The problem seems to be that `WP_REST_Request::get_parameter_order()`
 doesn't list `DELETE` as one of the methods that can pass a body in its
 variable `$accepts_body_data`.

 Is the idea to just always provide the DELETE's parameters in the
 querystring? (eg that's how I saw it done here: https://github.com/WP-API
 /WP-API/issues/789#issuecomment-73986884). If so I guess that's ok
 although I couldn't find it documented. ...But also, just adding `DELETE`
 to the `$accepts_body_data` array is an easy change too, right? From my
 own testing that change got it to work how I had hoped.

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


More information about the wp-trac mailing list