#38547 closed defect (bug) (fixed)
REST-API Json decode error will not give back an error
Reported by: | danielhuesken | Owned by: | rmccue |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.6.1 |
Component: | REST API | Keywords: | |
Focuses: | Cc: |
Description
If you send a Request to the Rest API with a defect json in body than it will not return a error. That is not so good, because you get back a response that suggest all is ok.
Method: POST
The problem is located at: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-api/class-wp-rest-request.php#L673
The 'return;' let it looks like all is ok and the answere will be the normel responce.
Attachments (1)
Change History (7)
#2
@
8 years ago
Can it be a solution, to set a header with error codes/message? That you have a hint about the problem.
This ticket was mentioned in Slack in #core-restapi by rmccue. View the logs.
8 years ago
Note: See
TracTickets for help on using
tickets.
Thanks @danielhuesken for the report! This seems legitimate to me. Throwing an error would help a lot for API clients that send malformed JSON - however we'll (maybe) want to make sure that if you send _both_ (I don't even know if that's possible) that we don't have a BC issue.