XHook
本文导语: XHook 可轻松的修改 XHR 的请求和响应。主要用于: Cache requests in memory, localStorage, etc. Insert authentication headers S3 Request Signing, see S3 Hook Simulate responses Create fake transparent backends for testing purposes Sending Error statistics to Google Analytics Po...
XHook 可轻松的修改 XHR 的请求和响应。主要用于:
Cache requests in memory, localStorage, etc.
Insert authentication headers
S3 Request Signing, see S3 Hook
Simulate responses
Create fake transparent backends for testing purposes
Sending Error statistics to Google Analytics
Polyfil CORS, by offloading requests to an iframe then splicing the response back in, see XDomain
Devious practical jokes
Preflight GZip compression, see XZip (In progress)
示例代码:
//modify 'responseText' of 'example2.txt' xhook.after(function(request, response) { if(request.url.match(/example.txt$/)) response.text = response.text.replace(/[aeiou]/g,'z'); });
支持的浏览器:IE8+, Chrome, Firefox, Safari
您可能感兴趣的文章:
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。