Using Charles Proxy to test different HTTP Response Codes

Using Charles Proxy to test different HTTP Response Codes

Note: If you’re new to Charles Proxy, you may need to read my earlier post on Using Charles Proxy for bandwidth throttling testing to get started on this.

Charles Proxy really is a neat box of tricks and two of the best are the Rewrite Tool and Breakpoints

Rewrite Tool 


This is a little bit awkward to setup, but once setup can easily be used and amended to return different HTTP Server Response Codes e.g. to simulate an error 500 – Internal Server Error.

1. In Charles Proxy, in the Tools menu, select Rewrite option

2. Click enable Rewrite

3. Add a test set of rewrite(s) using the Add button on the left and give the test set of rules a name

4. On the right hand side, you can then start setting up the locations (URLs) where you want your rewrite rules to happen

5. And below this, you can add a rule or set of rules for each location

As an example – Rewrite Settings name = Test Set 1, Location =, Rule = Response Status, Match Value = 200, Replace Value = 500

As long as Enable Rewrite is ticked, then all responses coming back from the server will then be with status = 500 – internal server error



Using breakpoints you can intercept – and edit – HTTP requests and responses

Steps to Follow to use breakpoints

1. Let the browser or app make requests as normal to see them in the Charles Sequence window

2. Then right-click on the host name you want to intercept – e.g. – and select Breakpoints from the list

3. In Proxy menu, ensure Breakpoints are Enabled (and not Disabled)

4. When you then make a request to that host, the breakpoint window will appear in Charles and allow you to intercept every request and response

5. You can also edit the Breakpoints list to set whether you want both requests and responses or just one of them for each host

There’s an excellent example here which shows you how you can intercept the JSON sent to the Weather Underground app in order to show the current temperature is 2500F!


About my testing services: iOS App Testing / Android App Testing / Website Testing