It's a pretty early version but it should be compatible with OS X and Windows. It's called tamper, it's based on mitmproxy and it allows you to see all requests made by the current tab, modify them and serve the modified version next time you refresh. I just released a Devtools extension that does just that :) And if you redirect a main_frame request, the user will see the data:-URI instead of the requested URL. Actually, the request will never hit the server because redirection can only be done before the actual request is sent. Unlike the XHR-approach, you won't get the original contents of the request. In other cases, you can use the chrome.webRequest or clarativeWebRequest APIs to redirect the request to a data:-URI. Make sure that your XMLHttpRequest object is fully compliant with Chrome's built-in XMLHttpRequest object, or AJAX-heavy sites will break. If you want to edit the response body for a known XMLHttpRequest, inject code via a content script to override the default XMLHttpRequest constructor with a custom (full-featured) one that rewrites the response before triggering the real event. Star the issue to get notified of updates. This feature is being requested at 104058: WebRequest API: allow extension to edit response body. In general, you cannot change the response body of a HTTP request using the standard Chrome extension APIs.
0 Comments
Leave a Reply. |