I want to monitor the network traffic from background.js (or content script) on any page with response body data.
I tried these before:
chrome.devtools.network which allows us to monitor the network only when devtool is open. (I need to do this in background or maybe injected script)
chrome.devtools.network.onRequestFinished.addListener((request) => {
if (request.response) {
console.log(request.response);
}
});
chrome.webRequest which gives us limited information about requests without their bodies.
chrome.webRequest.onCompleted.addListener((details) => {
console.log(details);
},
{urls: ["<all_urls>"]}
);
I also checked this
Chrome Extension - How to get HTTP Response Body?
Is it not possible for security or some other reason or is it possible to somehow observe the network traffic with the response body?