Comprehensive postman interface testing method series tutorial-how to send cookie request

         Due to professional relations, web and mobile development often call servers to provide restful interfaces for data requests. The most common thing we use now is to use the postman application to test the restful api interface request in the chrome browser. Today, I will mainly talk about how to use postman for interface testing and send cookie requests!

         For web testing, postman is basically used to do some interface testing, such as testing interface access rights. For certain interfaces, user A can access but user B cannot; for example, sometimes it is necessary to read file data. To achieve such a test on postman, we must use cookie requests. Use postman to send requests with cookies. Due to Chrome's security restrictions, postman cannot send requests with cookies. If you want to send a request with cookies, you need to enable postman Interceptor.

What is POSTMAN ?

         POSTMAN is a Chrome plug-in tool. We can search and install it through the Chrome application store. After installation, a postman icon will be displayed on the desktop. Each time you click this icon, you can start the POSTNA interface. After startup, the above interface is displayed. The left side is the directory structure used to manage the use cases, and the right side is the parameters and response content of the request content of a specific use case; the default postman will come with a demo project called "POSTMAN Echo", inside There are use case demos for various scenarios. For newcomers, you can learn how to use POSTMAN by viewing these demo use cases.

Use postman to test the interface and send the method with cookie request:

1. After installing the postman Interceptor in the Chrome browser, if you want to send a request with cookies, you need to turn on the Interceptor, and the Chrome browser must always be open during the test.


2. How does postman submit data? params->Body->form_data; Add interface parameters, select File type, select file, fill in parameters, and send;

 

3. You can use some tools for packet capture analysis, such as fiddler and wireshark. I use fiddler to capture the app request, and I can also use other tools. Check the cookie in the headers and copy it.

 

(If it is a web page, directly check the cookie of the Request Header in the Network of the corresponding page in chrome)

4. Fill the copied content into the headers in postman, the format of the cookie is Cookie:[value] When sending a cookie, add key-value in the header, the key is fixed to Cookie, and the value is the specific k=v of the cookie. As shown below:

 

Or click Bulk Edit next to it and paste the copied content directly

 

5. Finally, click the Send button.

Advantages of Postman test:

There are many HTTP interface testing tools, and there are many ways to make HTTP requests, but they can be used directly, and the functions are still supported. As far as I have used, postman is more effective.

Advantages of postman:

1. Support use case management

2. Support functions such as get, post, file upload, response verification, variable management, environmental parameter management, etc.

3. Support batch operation

4. Support use case export and import

5. Support cloud storage use cases [paid users]

It can be said that POSTMAN satisfies most of the functions of the HTTP interface test, and only a small part of the functions are not supported, such as: request flow control; so much has been said before, then let's take a look at the installation and use of POSTMAN.

Precautions:

1. The version of Intercept must match the version of postman, otherwise the send request will always be in the loading state.
2. Chrome browser must be opened when sending cookies.

 

@Copyright chrome plugin network

Guess you like

Origin blog.csdn.net/wangxi06/article/details/114877049