变量设置
作者:互联网
globals的变量ymy_im_gme
var arrayList = [
"/g/authorizations/login",//登陆接口
];
//获取不带参数和域名的路径
const path = pm.request.url.getPath()
if (arrayList.indexOf(path) == -1) {//-1则不存在
//设置平台
pm.request.addQueryParams("platform=my");
//设置头部token
pm.request.headers.add(
{key:"authorization",value:"Bearer " + pm.environment.get("ymy_im_gme_access_token")}//token
);
}
总
const pm_globals = pm.globals.get("ymy_im_gme")
eval(pm_globals);
token
var data = JSON.parse(responseBody);
pm.environment.set("ymy_im_gme_access_token", data.data.access_token);
图形验证码
// 将接口返回数据,封装成自己需要的结构
var data = {
response: pm.response.json()
}
// html 模板字符
var template = `<html><img src="{{response.data.img}}" /></html>`;
//查看数据
//pm.environment.set("base", data.response.data.img);
//存解码key
pm.environment.set("ymy_gm_admin_code_key", data.response.data.key);
// 设置 visualizer 数据。传模板、解析对象。
pm.visualizer.set(template, data);
标签:key,set,变量,ymy,token,设置,data,pm 来源: https://www.cnblogs.com/fizz001/p/16225852.html