[wp-trac] [WordPress Trac] #39150: Empty JSON Payload Causes rest_invalid_json
WordPress Trac
noreply at wordpress.org
Wed Dec 7 15:55:29 UTC 2016
#39150: Empty JSON Payload Causes rest_invalid_json
--------------------------+-----------------------------
Reporter: GamerZ | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 4.7
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
The rest_invalid_json error was introduced in #38547 which is meant to
detect defect json in body. However, if a empty body is used, this is
marked as invalid as well.
There are scenarios where empty body are used especially when deleting an
item.
For example calling a DELETE method on a custom endpoint like the below
means deleting the ID 1 from the item resource. There is no need to pass
in any unnecessary body content.
{{{
DELETE /wp-json/custom-endppint/item/1
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39150>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list