Intercept Fetch() API responses and request in Javascript
问题 I want to intercept the fetch API request and response in Javascript. For ex: Before sending the request want to intercept the request URL and once get the response wants to intercept the response. The below code is for intercepting response of All XMLHTTPRequest. (function(open) { XMLHttpRequest.prototype.open = function(XMLHttpRequest) { var self = this; this.addEventListener("readystatechange", function() { if (this.responseText.length > 0 && this.readyState == 4 && this.responseURL