ngrinder常用用法

在这个连接基础上补充:https://www.cnblogs.com/unknows/p/14348965.html

 获取响应头字段@Test:

	      String body = "{\"userName\":\"xiaocc\",\"password\":\"l3x0raKzacb26ZeR2G0A9IoW4HtE0NKdWmFoI52cKgM=\"}"
		HTTPResponse result = request.POST("http://10.248.12.10:3462/login", body.getBytes())//发起请求
		auth=result.getHeader('authorization')//获取响应头中的authorization字段值 

  设置请求头@BeforeProcess:

		// 设置请求头header
		List<NVPair> headerList = new ArrayList<NVPair>()
		headerList.add(new NVPair("Content-Type", "application/json"))
		//headerList.add(new NVPair("authorization", "Bearer"))
		headers = headerList.toArray()

  

posted @ 2022-05-24 19:08  垄上行  阅读(69)  评论(0编辑  收藏  举报