I\'m using Charles Proxy to rewrite a response from an API for testing purpose.
If I set a breakpoint, I am allowed to completely rewrite the raw response as I wish.
Using Charles 3.8+, you can rewrite the status code.
In the rewrite tool, select "Type: response status".
In the match fields and replace fields, be aware that Charles expects the incoming and rewritten statuses to match the format "\d{3} .*"
. This means that your rewritten status must have a message portion in addition to the numeric status code.
For example:
Match value: 201 .*
Replace value: 502 Bad Gateway
Omitting the message from the replace value will result in no rewrite of the status line. You can see Charles' rewrite tool output messages in the Notes section of each call's summary.