[wp-trac] [WordPress Trac] #49903: Can't post comment with content "0" (string with zero)
WordPress Trac
noreply at wordpress.org
Tue Apr 14 08:15:50 UTC 2020
#49903: Can't post comment with content "0" (string with zero)
--------------------------+-----------------------------
Reporter: Cawa-93 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 5.4
Severity: major | Keywords: needs-patch
Focuses: rest-api |
--------------------------+-----------------------------
If you try to post a comment with content "0" (string with zero), the
server will respond in error as if the content was missing.
Request code. Some headings are omitted as they are not important.
Authorization uses plugin "JWT Authentication for WP-API".
{{{
fetch("http://example.com/wp-json/wp/v2/comments", {
"headers": {
"authorization": "Bearer ...",
"content-type": "application/json"
},
"method": "POST",
"body": `{
"content":"0",
"post":123,
"parent":null,
"author":1,
"status":"approved",
"date_gmt":"2019-02-09T14:47:12.000Z"
}`,
});
}}}
Response:
{{{
{
"code":"rest_comment_content_invalid",
"message":"Invalid comment content.",
"data":{"status":400}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49903>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list