Better HTTP response error test

The original test gives a PHP notice (if WP_DEBUG is on), and thus errors in the admin page (when parsing the response as JSON).