title: How do I log the body of js network request with a chrome extension?
body: <p>I want to log the body of a network request that contains &quot;findme&quot; in its URL. In other words, I want to print the &quot;preview&quot; 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.</p>
  <pre><code>//background.js
  function logURL(requestDetails) {
  
      if (requestDetails.url.includes(&quot;findme&quot;))
      {
        let found = requestDetails.url
         console.log(&quot;Script found &quot; + found)
         console.log(requestDetails)         
         
      }
  
  
    }
  
    chrome.webRequest.onBeforeRequest.addListener(
      logURL,
      {urls: [&quot;&lt;all_urls&gt;&quot;]}
    );
  </code></pre>