加密处理
This commit is contained in:
parent
077c3518b4
commit
170051e46f
|
|
@ -27,9 +27,9 @@ const service = axios.create({
|
|||
|
||||
// request拦截器
|
||||
service.interceptors.request.use(config => {
|
||||
const encryptRequest = false
|
||||
const checkIntegrity = false
|
||||
const encryptResponse = false
|
||||
const encryptRequest = true
|
||||
const checkIntegrity = true
|
||||
const encryptResponse = true
|
||||
//入参加密
|
||||
config.headers['encryptRequest'] = systemConfig.requestConfig.encryptRequest && encryptRequest ? 'true' : 'false'
|
||||
// 数据完整性校验
|
||||
|
|
@ -52,7 +52,7 @@ service.interceptors.request.use(config => {
|
|||
config.params = {};
|
||||
config.url = url;
|
||||
}
|
||||
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
|
||||
if (config.method === 'post' || config.method === 'put') {
|
||||
const requestObj = {
|
||||
url: config.url,
|
||||
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
|
||||
|
|
@ -60,6 +60,7 @@ service.interceptors.request.use(config => {
|
|||
}
|
||||
let contentType = config.headers['Content-Type']
|
||||
// console.log('🚀 ~ contentType:', contentType, requestObj.data)
|
||||
console.log('🚀 ~ 要加密:', contentType.includes('application/json'), typeof requestObj.data)
|
||||
if (contentType.includes('application/json') && typeof requestObj.data !== 'undefined') {
|
||||
// 加密数据
|
||||
if (systemConfig.requestConfig.encryptRequest && encryptRequest) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue