How to solve the problem that the appid is empty when testing the WeChat applet interface

1. The difference between web interface testing and app/WeChat applet interface testing

The web interface is generally accessed through a browser, and the app interface is accessed through the mobile phone, so their header header requests are different, and the same is the User Agent parameter.

The User Agent in the header request of the web request uses Google as an example:

MAC:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36 Windows:Mozilla/5.0 (Windows; U;

Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13

User Agent in the header request of the app request:

Android:Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BLA-AL00 Build/HUAWEIBLA-AL00) Chrome/57.0.2987.132 Mobile Safari/537.36

ios:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36

2. How to test app interface

As mentioned above, there is a difference between app and web header requests, so we fill in the User Agent parameter when testing the app interface. The two options here represent Apple and Android respectively.

How to solve the problem that the appid is empty when testing the WeChat applet interface

Simulate a mobile phone request to access Baidu.

How to solve the problem that the appid is empty when testing the WeChat applet interface

3. There is no appid in the parameters when testing the WeChat applet interface. Why is the appid needed when requesting? What is the appid?

appid is a parameter that comes with the WeChat or Alipay application. It is like the ID number and ID number of the applet to facilitate identification.

When I tested the WeChat interface here, I encountered a situation where the appid was empty.

How to solve the problem that the appid is empty when testing the WeChat applet interface

Then the appid request of this small program is placed in the header, and it will not be empty after filling in.

How to solve the problem that the appid is empty when testing the WeChat applet interface

The token issue comes later.

To summarize: appid is generally required for WeChat applet authentication, so you can ask about development during interface testing, and they will all know what appid is. We only need to simulate the request for the mobile phone, fill in the appid and other parameters correctly, and then we can perform the normal WeChat applet interface test.

Tool download address:https://www.apipost.cn/?dt=20201104 Please add a link description

Guess you like

Origin blog.51cto.com/12246704/2546733