https://www.cnblogs.com/yoyoketang/p/10604746.html
Preface
Mock can be said to be a topic that must be asked in interviews. When I first came into contact with mocks, I also looked confused. Although the fiddler tool has been used for a long time, the interruption points and the function of setting automatic return data have been used.
The popular thing mock said is to simulate the return data, but the interviewer is so professional in order to pretend to be coerced. Simulate the return data, use fiddler to break the point to modify the return data and set AutoResponder can be achieved
AutoResponder
Use AutoResponder, modify the returned data and save it, let the interface return the modified data
Visit the online address: https://www.cnblogs.com/yoyoketang/ Use fiddler to capture the packet.
Find the captured data from the conversation box and drag it to the AutoResponder page
Right-click to edit the returned content
Click raw, modify the returned body content, click save after the modification is completed
Next, check Enable rules and check the interface that needs to be set. Reopen the browser and you can see that the content has been modified
When you check Enable rules, it is best to check Unmatched requests passthrougth at the same time. This option is to pass all unmatched requests.
Add Rule
If we want to return json data when requesting an interface address, it is also possible to add Add Rule here.
Click on the second input box of Rule Editor and select the last item "Find a file". After finding the local json file, right Save in the bottom corner
The content of the json file is as follows
{"error_code": 0,
"reason": "success",
"result": {
"data": {
"conclusion": "[大吉+官运+财运+才艺]如龙得云,青云直上,智 谋奋进,才略奏功",
"analysis": "欲望难足希望高,计谋成功财力豪,猜疑嫉妒性自 改,如龙乘云势运开。"
}
}
}
Next, enter in the browser: https://www.baidu.com/
the json content just set will appear
Setting to return to the local html file is the same operation
Set address jump
When accessing an external network address, how to jump to the local connection? You can also set the rule jump here
. Set the rule as shown in the figure below. https://www.sina.com.cn/
When you visit , jump to the local jenkins address.http://localhost:8080/login
Analog status code
AutoResponder can also simulate status codes, such as 302, 401, 502
When you revisit https://www.sina.com.cn/
, the 401 authentication box will pop up
Can also simulate network delay *delay:100