当前位置:网站首页>Charles: four ways to modify the input parameters or return results of the interface
Charles: four ways to modify the input parameters or return results of the interface
2022-07-07 12:35:00 【Xiaoding Chong duck!】
Preface :
charles It is a commonly used packet capturing tool in development , It's very powerful , Among them, those who can directly modify the request are 4 Methods , Namely :map Local、map Remote、Rewrite and Breakpoints.
One 、 map Local
1. effect
Will match url Map to local file
2. Applicable scenario
(1) You need to constantly modify the returned results of the interface to test various case
(2) When the back end of a requested return result is difficult to simulate
3. step
(1) Save the response result of the request : Right click on the request save Response, Save the original message locally

(2) Map the request to the file : Right click on the request Map local

Map the request to your local file

(3) According to the demand , Modify the local file and save , When the interface is requested again , You will see that the returned result has been changed to the local file we mapped
Two 、 map Remote
1. effect
Remote mapping , That is, map the domain name you want to request to another remote domain name . Usually used to switch environments ,
2. Applicable scenario
(1) Switch the interface of the test environment to the online environment
(2) Protocol conversion , If you put https become http
3. step
(1) After selecting the request , Right click on the Map Remote

(2) Modify the mapping address information according to the situation

(3) Refresh the page and re request , You will find that the request has been mapped to the modified new address
3、 ... and 、 Rewrite
1. effect
For matching url, Regular substitution request or response All kinds of values , Include header、host、url、path、query param、response status、body
2. Applicable scenario
(1) Modify the input parameters of the request 、header Medium parameters and other scenarios
3. step
(1) Click on Tools → Click on Rewrite

(2) Check Enable Rewrite, Click on add, Add the request that needs to be rewritten url Information

(3) Click on the bottom right corner add Add fields that need to be rewritten


(4) Refresh the page and re request , You will find that the modified field has been rewritten
Four 、 Breakpoints
1. effect
Yes url Breaking point , Interrupts Request or Response, When pausing, you can modify the request data or response results
2. Applicable scenario
(1) Every request needs to be modified Request or Response Of header、 Enter the reference 、 Return partial values of results, etc
3. step
(1) Right click on the request Breakpoints, That is, open the breakpoint ( The default is Request and Response, Can be found in Breakpoint Settings Revision in China )

(2) Breakpoints can be modified Request or Response Value

(3) Click Execute, After continuing to execute, you can see that the modification takes effect
边栏推荐
- Epp+dis learning road (2) -- blink! twinkle!
- Solutions to cross domain problems
- Will the filing free server affect the ranking and weight of the website?
- Simple network configuration for equipment management
- DOM parsing XML error: content is not allowed in Prolog
- 跨域问题解决方案
- "Series after reading" my God! It's so simple to understand throttling and anti shake~
- Idea 2021 Chinese garbled code
- [Q&A]AttributeError: module ‘signal‘ has no attribute ‘SIGALRM‘
- 编译 libssl 报错
猜你喜欢

30. Feed shot named entity recognition with self describing networks reading notes

Sort out the garbage collection of JVM, and don't involve high-quality things such as performance tuning for the time being

IPv6 experiment

Solutions to cross domain problems

Idea 2021 Chinese garbled code

The hoisting of the upper cylinder of the steel containment of the world's first reactor "linglong-1" reactor building was successful

Vxlan static centralized gateway

Airserver automatically receives multi screen projection or cross device projection

In the small skin panel, use CMD to enter the MySQL command, including the MySQL error unknown variable 'secure_ file_ Priv 'solution (super detailed)

ENSP MPLS layer 3 dedicated line
随机推荐
The left-hand side of an assignment expression may not be an optional property access. ts(2779)
Baidu digital person Du Xiaoxiao responded to netizens' shouts online to meet the Shanghai college entrance examination English composition
Static comprehensive experiment
[play RT thread] RT thread Studio - key control motor forward and reverse rotation, buzzer
Epp+dis learning path (1) -- Hello world!
Session
Using stack to convert binary to decimal
111. Network security penetration test - [privilege escalation 9] - [windows 2008 R2 kernel overflow privilege escalation]
Configure an encrypted web server
Financial data acquisition (III) when a crawler encounters a web page that needs to scroll with the mouse wheel to refresh the data (nanny level tutorial)
idea 2021中文乱码
H3C HCl MPLS layer 2 dedicated line experiment
How much does it cost to develop a small program mall?
leetcode刷题:二叉树26(二叉搜索树中的插入操作)
【PyTorch实战】用PyTorch实现基于神经网络的图像风格迁移
Airserver automatically receives multi screen projection or cross device projection
数据库系统原理与应用教程(010)—— 概念模型与数据模型练习题
SQL head injection -- injection principle and essence
【玩转 RT-Thread】 RT-Thread Studio —— 按键控制电机正反转、蜂鸣器
Attack and defense world ----- summary of web knowledge points