I'm making an ajax request using the 'request' node package and it has worked elsewhere in my application when making calls from other APIs however when I'm making a request to this specific API I get bodies that look like this:
�5�Ak1���0^����B�y��A�J�hf���H��*K��#�����e�7#�bB������뻡���p��I�9�ࢣ��o�Fg?�G��ä�5Ї�u��j���n�Z)�UJ;����ű��Z�賢f�,�hEޥ��((�$�xp��'q�Į�Ykc�)L�TOm��>d�/�R�o���,��
Below shows my code:
const requestOptions = {
url: 'CORRECTLYFORMATEDURL',
};
request(requestOptions, function (error, response, body) {
fs.writeFile("test.txt", body, function(err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
});
If I enter this url into a web browser I get a correctly formatted JSON object which is why this isn't making any sense to me.