When I run my code, it first logs the URL of the network request then when I try logging the body, it just says undefined. When I click on the URL link that is logged in the console from the first console.log, it downloads the js file onto my PC that I am trying to print. Is there something wrong with my requestBody or is there another way of printing the content of the js file into the console without having to open it?
//background.js
function logURL(requestDetails) {
if (requestDetails.url.includes("getMe"))
{
console.log(requestDetails.url)
console.log(requestDetails.requestBody)
}
}
chrome.webRequest.onBeforeRequest.addListener(
logURL,
{urls: ["<all_urls>"]},
['requestBody']
);