node-XMLHttpRequest icon indicating copy to clipboard operation
node-XMLHttpRequest copied to clipboard

event in onreadystatechange callback is undefined

Open kasbah opened this issue 10 years ago • 2 comments

This simple example

XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
xhr = new XMLHttpRequest();
xhr.open('GET', 'https://github.com');
xhr.onreadystatechange = function (event) {
  console.log(event);
};
xhr.send();

outputs

undefined
undefined
...
undefined

I tried this with both https and http urls. I am using node v0.12.7.

kasbah avatar Aug 03 '15 14:08 kasbah

I get the same thing. :+1: I need a fix to this.

Dynasty9 avatar Sep 02 '15 20:09 Dynasty9

+1 to this request. In the meantime @flububb's patch worked well for me too, as I only needed event.target for testing

hattmarris avatar Feb 09 '16 22:02 hattmarris