I’m sending a POST request to a REST API endpoint, and am receiving JSON response back filled with question mark diamonds and other unicode characters. But when I test API on Postman, I am correctly receiving JSON response. Here is my code for calling API:
xhr.open(method,url);
xhr.setRequestHeader("Authorization", "Bearer" + " " + accessToken);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.status);
console.log(xhr.responseText);
}};
xhr.send(JSON.stringify(data));
The response I’m getting is like this: ��}�r�8���|ʧj���t���<Pe3�H���8�灖(��2�!��=S]�?䜟�_r��I�”