Share a gadget boast: how do I track all HTTP requests from the server and easily replay them?

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Original link: http://blog.phpor.me/note/2017/03/31/track-and-replay-http-request.html

Client engineer: "The XXX interface is broken, my program has not moved," the backend will often receive such questioning, but how do we reproduce the problem now? There are several situations:

First, the back end of the test to find no problem

"I tested here is good ah", you can only let the client engineer again, see the error after a certain problem, you have to find the problem, this time this cell phone, and the data inside the phone is very important, because the data can be used to reproduce the Bug.

Second, the test is also a problem

At this time the backend will go to modify the program, but every time the test whether there are problems need to operate in the client, sometimes the operation is very complex, it takes a lot longer. Finally make a variety of Avatar finally found the problem, it is this user's such data has an exception to this situation.

This is not uncommon, the most troublesome point is that each time the same parameters to the occurrence of the Bug to request, sometimes you know the parameters of these requests, you can put them in the Postman tool, but most of the time you do not know its corresponding parameters (token)

If we can track all requests on the server: interface address, header,body, back end of the Header, Body, so that we can find the corresponding request parameters and return value, you can directly fill in the Postman inside, if you can also re-request a key to the good, Because we do not want to modify the parameters of the request, just want to request again with the same parameters, so we can debug the corresponding program.

Just before used Ngrok, found that it has a very good debug interface, can achieve the above requirements, but now do not need its network penetration function, so can only write a program, only contains the following functions:

* Record interface for all Request and Response
* A request can be re-requested with one click

Basic working principle

HTTP client boast Web server | GET http://localhost:8080/| Log requests and Reverse proxy | Response ok| ---------------------------> | --------------------------> |                              ------┐|                             |       |                              || |  Record return information and forward to client | <----┘| <---------------------------| <--------------------------|┌----------------------------------------------------------------------------┐| url:http://localhost:8081 | | ---------------------------------------------------------------------------|| All transactions┌------------------------┐| | ----------------------   | Time:10 hours ago client:127.0.0.1 | | | |   get/200 OK ms |                                               | | || ----------------------   |                          Request [Replay] | | | | -   -   -   -   -   -   -   -   -   -   -   - | || |                          GET http://localhost/HTTP/1.1 | | | |                          user-agent:curl/7.51.0 | | | |                          Accept: */* | | |                                               |                          | || |                          Response | | | |                          -   -   -   -   -   -   -   -   -   -   -   - | || |                          http/1.1 OK | | | |                          X-server:httplab | | | |                          Date:thu, 02:25:27 GMT | | | |                          content-length:13 | | | | Content-type:text/plain;                          Charset=utf-8 | | |                                               |                          | || | HelLo, World | | |                                                                            └------------------------┘| | |└----------------------------------------------------------------------------┘

Recently learning Go, just take it to complete this small program, named boast in order to allow us to reproduce the Bug more active and convenient, and faster repair, a lot of time to build the wheel!

[Boast project address] (Https://github.com/dcb9/boast)

Go and front-end are now learning to sell, welcome everyone to shoot bricks.

773 reads ∙1 likes
Related Article

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.