首先,我要用jmeter模拟登录的网站如下:
![](https://img-blog.csdnimg.cn/img_convert/91eed4afa9498bed679b6306bcab7a39.png)
我在jmeter里的登录请求填写如下:
![](https://img-blog.csdnimg.cn/img_convert/9cfca7d7265eae9897fa6ce41e76a4ac.png)
其中具体的path: /front/haey-ques-manage/#/ 我是直接从浏览器地址栏里复制粘贴的
运行后报错405,如下:
![](https://img-blog.csdnimg.cn/img_convert/6b0bc782162ea2014bed28ad54c2f7d1.png)
但是将POST请求换为GET请求,却会请求成功
![](https://img-blog.csdnimg.cn/img_convert/9522b12ecf4d55aefd43d5f779f4a6c7.png)
![](https://img-blog.csdnimg.cn/img_convert/014ca31f1e846a96e7a012aa07c36e6c.png)
原因是我的path填写错误,下方的地址仅仅代表一个网页(这是个页面地址,不是接口地址),没有数据交互,所以我用POST请求会报405(HTTP请求方法不被允许),而用GET请求会返回200,请求获取网页成功。
![](https://img-blog.csdnimg.cn/img_convert/d8a5ea5487489e51205fea31ac7ac684.png)
![](https://img-blog.csdnimg.cn/img_convert/cf904a6d98b422ab139b8f01938dea80.png)
真正的登录url如下,抓包获得(这才是接口地址,用Jmeter进行数据交互要用到此地址):
![](https://img-blog.csdnimg.cn/img_convert/a60f4039c62bd36363acf09c42c43ec2.png)
更改之后请求登录成功。
![](https://img-blog.csdnimg.cn/img_convert/fe22af18b3bb8bdb619d7dce6383dc4e.png)
![](https://img-blog.csdnimg.cn/img_convert/6f0d252b48552c40d754a9a6db92d542.png)
![](https://img-blog.csdnimg.cn/img_convert/83619b3959add96ebba6a83ab1026633.png)