Skip to content

Commit

Permalink
fix: Cancel onload interception
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ngjie committed Dec 8, 2022
1 parent ae49473 commit 247504f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/proxy-lib/src/createXHR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,18 @@ class CustomXHR extends XMLHttpRequest {
this.onreadystatechange && this.onreadystatechange.apply(this, args);
};
continue;
} else if (attr === "onload") {
xhr.onload = async (...args) => {
// 开启拦截
await this.maybeNeedModifyRes(xhr.response);
this.onload && this.onload.apply(this, args);
};
continue;
}
// else if (attr === "onload") {
// xhr.onload = async (...args) => {
// // 开启拦截
// await this.maybeNeedModifyRes(xhr.response);
// this.onload && this.onload.apply(this, args);
// };
// this.onload = null;
// continue;
// }
// 其他属性重写
// @ts-ignore
this.overrideAttr(attr, xhr)
this.overrideAttr(attr as keyof XMLHttpRequest, xhr)
}
}
}
Expand Down

0 comments on commit 247504f

Please sign in to comment.