新增环境header

This commit is contained in:
qiaomu 2024-03-25 16:35:37 +08:00
parent f8c31d6bb7
commit 756f567dba

View File

@ -20,10 +20,13 @@ const requestWithoutCookie = promisify(wx.request);
// 考虑了Cookie的请求 // 考虑了Cookie的请求
const request = async function (options) { const request = async function (options) {
let token = wx.getStorageSync('token'); let token = wx.getStorageSync('token');
const result = wx.getAccountInfoSync();
const { envVersion } = result.miniProgram;
options.header = { options.header = {
Accept: 'application/json', Accept: 'application/json',
'content-type': 'application/json; charset=utf-8', 'content-type': 'application/json; charset=utf-8',
"Authorization": token "Authorization": token,
"env": envVersion
}; };
let response; let response;
try { try {