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:
- The
Content-Length
header is not updated to reflect the new data I've added to the response. I have to manually update it myself. - Even if I update the
Content-Length
manually, it seems the new GZIP body is invalid (ie, it is not GZIPed correctly).
I can't just remove the Content-Encoding: gzip
from the request because I don't have control over the code that consumes the response. 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 Content-Encoding: gzip
from the request.
How can I modify a GZIPed response body using Charles?