When the /wp-json/dlm/v1/licenses/activate REST API endpoint can not find the license key, it returns a WP_Error object with the message as a code and without an HTTP status.
Steps to reproduce
Use the dlm-wp-updater library to render an activation form.
Enter a license key that does not exist in the server.
Expected response
"The license key 'imaginary-key' could not be found" is displayed as a WordPress error notice.
Actual response
"Unable to decode response. (2)" is displayed as a WordPress error notice.
Solution
This PR changes the WordPress error response to send a data_error code, the message as a message, and an HTTP status of 404 as extra data.
Issue
When the
/wp-json/dlm/v1/licenses/activate
REST API endpoint can not find the license key, it returns aWP_Error
object with the message as a code and without an HTTP status.Steps to reproduce
dlm-wp-updater
library to render an activation form.Expected response
"The license key 'imaginary-key' could not be found" is displayed as a WordPress error notice.
Actual response
"Unable to decode response. (2)" is displayed as a WordPress error notice.
Solution
This PR changes the WordPress error response to send a
data_error
code, the message as a message, and an HTTP status of 404 as extra data.