这是为了返回的cookie不在响应体里面不是json格式的,而是在响应头里面,前面已写在响应体里面用json path extractor获取cookie
1、给登录的请求下添加一个正则表达式提取器,从头部提取JSESSIONID:

原本登录返回的JSSESSIONID如下:

所以我们正则表达式写为如下的格式:
Set-Cookie: JSESSIONID=(.*); Path=/lanzhouhf_Web; HttpOnly
2、然后添加http cookie管理器
这里写上域名和路径后,后面的以此为开头的请求都能获取到这个cookie

3、再次运行后就能看到,登录后的请求就包含cookie了

网友评论