Charles proxy modified response Charles proxy modified response json json

Charles proxy modified response


STEPS TO RE-RUN THE SAVED RESPONSE:

1) Right click and save response in any of your system folder.

2) Right click the service that you want to hit with saved data.

3) Scroll down, you will be seeing an option for Map remote and map Local

enter image description here

4) Select Map Local, Edit mapping dialogue box appears.

enter image description here

5) Choose the local file you saved. Done

Now each time you hit the same, the locally saved response will be called. Once your testing is completed, please do right click and select map local to remove it.

https://medium.com/@vsujananthhttps://youtu.be/HKfVAXMjw_8


There are 3 diifferent ways to modify response body in Charles Proxy:

1) And this is my favorite - use Tools -> Rewrite.Here you can set a set of rules for the network call, such as you desire. Do it by choose single ot multiple URL (or part of it) under the "location" section.Under "Rules", add a new rule and choose "URL" for type and your desired URL response under "values" section. You can choose a URL that contains the desired response or either create a mock one (by using tools such as "mocky.io").

2) You can use "Map Remote" and do the same - choose the network you would like to modify with the URL that contains the response you desire.

3) "Map Local" is good in case you like to modify the response body frequently - choose the network you would like to modify with a local file (in your case .json file). You can modify it between requests and save it.

I prefer the "Rewrite" option since:(1) it can contains multiple URLs to modify with multiple "desired" URLs and you just need to activate/deactivate by your current needs. (2) "Map Remote" has bugs in some Charles versions where you import external rules and your previous rules are totally overriden.(3) On "Rewrite" you can modify many things regarding the call, such as modifying substring in the response body (by choosing "Body" as the rule type), adding/modifying/removing query parameters or modifying the response status code.