为什么 XMLHttpRequest.prototype.open 中“this”对象的属性为空?

问题描述

我正在尝试使用以下代码拦截 Http 响应:

var rawOpen = XMLHttpRequest.prototype.open;

XMLHttpRequest.prototype.open = function() {
    console.log("this",this); // I can see that this object is not null and this.response is not empty
    console.log("response",this.response); // But,here this.response is empty. Why?
    rawOpen.apply(this,arguments);
}

正如我在代码中所评论的,this.response 不为空。但是,当我将相同的内容写入控制台时,它显示为空。事实上,我尝试从 this 对象访问的任何属性显示为空。这里出了什么问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)