title: How can I obtain the original encoded response size when intercepting requests with Puppeteer?
body: <p>I'm using this code to log the encoded response size when loading a page in Chrome:</p>
  
  <pre><code>const puppeteer = require("puppeteer");
  
  (async function() {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
  
    page._client.on("Network.loadingFinished", data =&gt; {
      console.log("finished", { encodedDataLength: data.encodedDataLength });
    });
  
    // await page.setRequestInterception(true);
    // page.on("request", async request =&gt; {
    //   request.continue();
    // });
  
    await page.goto("http://example.com");
    await browser.close();
  })();
  </code></pre>
  
  <p>This is the output: </p>
  
  <blockquote>
    <p>finished { encodedDataLength: 967 }</p>
  </blockquote>
  
  <p>However, if I uncomment the four lines in the code snippet the output changes to:</p>
  
  <blockquote>
    <p>finished { encodedDataLength: 0 }</p>
  </blockquote>
  
  <p>This does make some sense, since the intercepted request could have been modified in some way by the client, and it would not have been gzipped again afterwards.</p>
  
  <p>However, is there a way to access the original gzipped response size?</p>
  
  <hr>
  
  <p>The Chrome trace also doesn't include the gzipped size:</p>
  
  <blockquote>
    <p>"encodedDataLength": 0,
    "decodedBodyLength": 1270,</p>
  </blockquote>