"Go" uses fiddler for HTTP Breakpoint debugging.

Source: Internet
Author: User

This is one of Fiddler's powerful and practical tools. By setting breakpoints, Fiddler can:

1. Modify the HTTP request header information. For example, the request header of the UA, Cookie, Referer information, through "forge" the corresponding information to achieve the corresponding purpose (debugging, simulation of user real request, etc.).

2. Construct the request data, break through the limits of the form, and submit the data at will. Avoid page JS and form restrictions affecting debugging.

3. Intercept the response data and modify the response entity.

Why is the above method important? Suppose the JS front-end programmer and the server programmer is the division of labor, JS programmers want to debug the function of Ajax requests, so that the server-side programmers do not have to wait for the development of all interfaces before the development of the JS side of the AJAX request function, because through the "simulation" of the real server-side response, can guarantee the correctness of the function, and the server-side development programmer, as long as the final response is guaranteed to comply with the provisions. This greatly simplifies the efficiency of program development and, of course, reduces the difficulty of linking programmers to different lines of business.

There are two ways of setting breakpoints:

1.fiddler menu bar->rules->automatic breakpoints-> Select a breakpoint, in this way the breakpoint set will be valid for all subsequent HTTP requests.

There are two breakpoint locations:

A. Before response. That is, after the request is sent, but before the Fiddler agent Relays, the requested data can be modified.

B.after Response. That is, after the server responds, but before fiddler the response to the client. You can then modify the result of the response.

2. Enter the command line. Bpafter xxx or BPV,BPU,BPM, etc. set breakpoints. This breakpoint is only for a specific type of request.

As an example of a local Web project, we demonstrate how to set HTTP breakpoints simply:

1. First set up the Firefox agent, so that it can crawl all HTTP requests (localhost request, you can also set in the filter only crawl intranet request), set as shown:

2. Then open the local project with the Web. The content of the page is:

4. Set the post-response breakpoint (after response breakpoint), which can be set via the command line: Bpafter localhost. After you type enter, the Web accesses the file again, and through the Fiddler Web session interface, you can see that the request has been hung up, and the Web browser has been loaded. Looking at the right side of the Inspector panel, there is something new:

In this case, we can modify the response information. The modification process is:

Switch to the TextView sub-panel, select the section you want to modify, and then click "Run to complete" to echo the modified response. Suppose we revise the following:

After clicking on Execute, open the Web interface just now. Can see the changes of the page.

Visible, the response of the page has changed accordingly. This is the post-response breakpoint. Of course, in practical applications, breakpoints are more complex to set and respond to than this, and here is just a basic example.

The ways to terminate breakpoints are:

1. Clicking "Run Complete" on the Inspector interface terminates the breakpoint for this HTTP request.

2. Entering the GO command also causes the current request to skip the breakpoint.

3. Disabled breakpoints in Rules->auto breakpoint.

"Go" uses fiddler for HTTP Breakpoint debugging.

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.