I want to log the body of a network request that contains "findme" in its URL. In other words, I want to print the "preview" part in dev tools into the console when a network request with the name findme is detected. When I was working with puppeteer, I was able to use the text() function to achieve this. Right now, my code only logs the URL of the request and what I assume to be the header.
//background.js
function logURL(requestDetails) {
if (requestDetails.url.includes("findme"))
{
let found = requestDetails.url
console.log("Script found " + found)
console.log(requestDetails)
}
}
chrome.webRequest.onBeforeRequest.addListener(
logURL,
{urls: ["<all_urls>"]}
);