I am trying to intercept the response from all Promises then method. But i am not able to get the response data in the prototype then method. please find below code.
(function(Promise) {
var originalThen = Promise.prototype.then;
var originalCatch = Promise.prototype.catch;
Promise.prototype.then = function() {
console.log(this, arguments);
return originalThen.apply(this, arguments);
};
Promise.prototype.catch = function() {
return originalCatch.apply(this, arguments);
};
})(this.Promise)
In the above code I can see the console printed in all Promise call. But i cannot get the response object in the then.
The Printed 'this' object value in console:
The printed arguments inside the 'then' prototype method:
Please suggest me to get the response object in then method for all promises method.
I tried to get the value using "arguments[0].arguments" (Response object in the then callback).But its throwing the below error
Uncaught TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context.
Please suggest me the solution to intercept the response object.
Thanks in advance.

