Fiddler enables app front-end isolation development

Source: Internet
Author: User

Demand

Now the basic app development process is to start agile development after the requirements have been set. After the client and the server are required to negotiate a set of protocols, both the server and the client begin to develop in parallel. In principle the client should trust the server side, but it backfired, often appear the service side returns some not the client wants the data, causes the application after the online various anomalies. In order to minimize the impact on the client side of the server, we can use some tools to help us develop. Today is to say is fiddler (Http://www.telerik.com/fiddler) this artifact.

Principle

Fiddler is a grab bag tool, the difference is that the capture tool is only for the HTTP protocol. And it can open a local proxy server, let the phone connected to the fiddler, grab all the HTTP messages above the phone (if paired with the Wireshark can also catch except HTTP data).

Installation

Fiddler installation Exception Simple:
1, installation. NETFramework (ignored if installed)
2, install fiddler. (next)

Connect your phone

To use Fiddler to debug the communication above the phone, you need to set up a simple:
1. Click Tools–>fiddler Options, select the Connections tab, and then tick allow remote computers to connect

2, let the mobile phone connection fiddler Proxy Server, first find the IP address of the machine: in cmd Enter the ipconfig command:

Then configure the proxy server on the phone, take Android as an example, in the WiFi advanced settings There are set proxy options, instead of manually:

After clicking "OK", you can see the phone HTTP request captured in Fiddler. is not very simple. It also comes with the effect of debugging messages Oh ~

Forge Request Data

Some other features of fiddler, such as Filter,log,timeline, can be studied slowly by the reader. The main character we are going to talk about today is autoresponder (auto reply). As the name implies, it is possible to automatically return interface data. The Third tab to the right of Fiddler is Autoresponder. We just need to configure the rules here.
Click Add Rule, you can write your own rules at Rule editor, you can use a specific URL, or you can write regular expressions. If we have selected an option on the left message, the rule editor automatically fills in the request address corresponding to the message on the left. Now we create a. json file on top of the computer, write the content that the interface wants to return, save it, and then we can select "Find a file" in the bottom input box to select the defined protocol file.

Finally click on "Enable Automatic Responses", these rules will begin to take effect. We can also export the rules and then use them: Select the rule to export, right-click, select "Export All" to export the configuration, and then to other people to use. Isn't it convenient?

Summarize

This feature of Fiddler allows us to set up a series of rule that defines the data that is requested by an interface. For example, our server address is 10.128.127.10, we can create and maintain a set of fake data configuration according to the rules defined in the interface document, and then to all the development of the client's program ape use, in the case of parallel development, the efficiency can be greatly increased. We can even build a git repository to manage this configuration file, and if the interface is updated, the configuration needs to be updated as well. This completely does not need our own in the code or local files to forge the interface data debugging, directly can simulate the real environment to write code, the real implementation of runtime Debug.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Fiddler enables app front-end isolation development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.