使用签名 HTTP Client 的加密库 crypto
获取 token 后 全局变量中
### 获取 token
GET {{host}}/api/getBtzhDocApi?apikey=xxxx&userid=xxxx
userid: xxx
user-user-agent: JAVA
Content-Type: application/x-www-form-urlencoded
Accept: application/json
> {%
client.global.set("auth_token", response.body.data.token);
client.log(client.global.get("auth_token"));
%}
签名在发送请求之前
< {%
const originalText = "{encodeFlag=0&ofdStr=U0dWc2JHOHNJRmR2Y214a0lRPT0=&sealid=xxxx&signConfigJson={\"stampedPages\":\"2\",\"x\":\"140\",\"y\":\"250\"}}@xxxx";
const signature = crypto.md5().updateWithText(originalText)
.digest().toHex();
client.log('signature: ' + signature)
request.variables.set("signature", signature)
%}
POST {{host}}/ythptdzzz/api/xxx/xxx
userid: xxx
token: {{auth_token}}
sig: {{signature}}
user-user-agent: JAVA x-b3-traceid x-b3-spanid x-b3-parentspanid
Content-Type: application/x-www-form-urlencoded
encodeFlag=0&ofdStr=U0dWc2JHOHNJRmR2Y214a0lRPT0=&sealid=xxx&signConfigJson={"stampedPages":"2","x":"140","y":"250"}