[wp-trac] [WordPress Trac] #35028: WP_Error objects returned by REST API validation callbacks aren't formatted correctly
WordPress Trac
noreply at wordpress.org
Sat Dec 12 18:30:50 UTC 2015
#35028: WP_Error objects returned by REST API validation callbacks aren't formatted
correctly
----------------------------------------+------------------------------
Reporter: bradyvercher | Owner: joehoyle
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 4.4
Severity: normal | Resolution: fixed
Keywords: has-patch needs-unit-tests | Focuses:
----------------------------------------+------------------------------
Comment (by joehoyle):
I updated the response format to be:
{{{
{
"code":"rest_invalid_param",
"message":"Invalid parameter(s): software_id, software_version",
"data":{
"status":400,
"params":{
"software_id":"Invalid software identifier.",
"software_version":"Invalid parameter."
}
}
}
}}}
This makes it a bit more readable too. Also, added unit tests for
returning a WP_Error from the validate callback. Thanks bradyvercher!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35028#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list