XMLHttpRequest body empty although same origin

Viewed 19

I am accessing https://example.com/about/edit (Domain changed for privacy reasons) from my browser. There, I have JavaScript code running that is sending a HTTP request to https://example.com/about/api/id with an identifier for an object on my server.

let xhr = new XMLHttpRequest();
xhr.open("GET", "https://example.com/api/"+id, true)
xhr.send(null)
console.log(xhr.responseText) // <empty string>

The interesting thing is that xhr.responseText is empty, though I can see it in my Firefox network tab and also the request is from the same origin.

Photo from firefox

Help would be very much appreciated!

0 Answers
Related