请教一下 jmeter 对请求体进行base64加密

请教一下 jmeter 对请求体进行base64加密 ,应该怎么弄

使用 BeanShell。

分享下我的方式:
1、写个jar包来进行加解密,放在jmeter的ext目录下;
2、使用BeanShell来进行具体的操作;

import java.util.Base64;
import sun.misc.BASE64Encoder;
data=“{"username":"admin",”+
“"password":"12345a"}”;
//JSONObject json = JSONObject.fromObject(data) ;
//String strJson=json.toString();
BASE64Encoder encode = new sun.misc.BASE64Encoder();
String res = encode.encode(data.getBytes(“utf-8”));
//log.info(“----------------”+authorization);
vars.put(“base64”,res);

1 个赞