fiddler 保存请求数据并发送到自己的服务器接口

通过Rules菜单打开 Customize Rules 

 

搜索 OnBeforeResponse 方法,再方法后面添加如下代码:

 

    if (oSession.fullUrl.Contains("https://mp.weixin.qq.com/mp/")){
            //通过ajax发送到服务端
            var xhr = new ActiveXObject('Microsoft.XMLHTTP');
            var url = 'http://domain.com/notify_url';
            //发送的数据
            var data = '{"response":"'+ oSession.GetResponseBodyAsString() +'","url":"'+ oSession.url +'","headers":"'+ oSession.oRequest.headers +'","raw":"'+ oSession.GetRequestBodyAsString() +'"}';
   
            //不需要返回值所以写啦个空回调
            xhr.onreadystatechange = function() {}
            xhr.open('POST', url, true);
            xhr.setRequestHeader("Content-Type", "application/json");
            xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
            xhr.send(data);
        }        

 

posted @ 2019-11-15 23:27  rubekid  阅读(742)  评论(0编辑  收藏  举报