title: Charles - How to rewrite a HTTP response encoded in GZIP?
body: <p>I am trying to change the body of a HTTP response (for debugging purposes) using Charles webproxy. However, the response is GZIPed and when I modify something in the body (using the Tools-->Rewrite options) two problems emerge:</p>
  
  <ol>
  <li>The <code>Content-Length</code> header is not updated to reflect the new data I've added to the response. I have to manually update it myself.</li>
  <li>Even if I update the <code>Content-Length</code> manually, it seems the new GZIP body is invalid (ie, it is not GZIPed correctly).</li>
  </ol>
  
  <p>I can't just remove the <code>Content-Encoding: gzip</code> from the <strong><em>request</em></strong> because I don't have control over the code that consumes the <strong>response</strong>. That code is always expecting a gzip body and it fails to parse the data if I remove the GZIP encoding from the response by removing the <code>Content-Encoding: gzip</code> from the request.</p>
  
  <p>How can I modify a GZIPed response body using Charles?</p>