Skip to content

Commit

Permalink
2020/9/13
Browse files Browse the repository at this point in the history
  • Loading branch information
KonghaYao committed Sep 13, 2020
1 parent b389dad commit 9934525
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 36 deletions.
33 changes: 0 additions & 33 deletions example/Getwatch.js

This file was deleted.

7 changes: 4 additions & 3 deletions example/POSTwatch.js → example/XHRwatch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/**
* 拦截 XHR POST 请求
* 拦截 XHR请求
* @description 单独导入 Hook 模块,并拦截 XHR 请求
* @date 2020-09-10
* @param {Regexp} urlReg 匹配到后会进入 debugger
*/
async function POSTwatch(urlReg) {
async function POSTwatch(urlReg, method = "get") {
// Hook XHR函数
window.Hook =
window.Hook ||
Expand All @@ -18,7 +19,7 @@ async function POSTwatch(urlReg) {
// open 函数添加前置函数
XMLHttpRequest.prototype.open.Func.push((args) => {
let [type, url, ...any] = args;
if (urlReg.test(url) && type.toLocaleLowerCase() === "post") {
if (urlReg.test(url) && type.toLocaleLowerCase() === method) {
window.STOP = true;

//解析参数 并发出
Expand Down

0 comments on commit 9934525

Please sign in to comment.