3.7.0 • Published 2 years ago
encrypt-axios v3.7.0
安装
npm install encrypt-axios --save
用法
// 请求和响应拦截器中使用SM2加密解密
// ES6
import axiosDefine from 'encrypt-axios';
// axios实例
const client = axios.create({
baseURL,
timeout: 6000
});
// options 配置项
const options = {
baseURL: '', // baseURL 配置获取加密信息的公钥和token的请求地址
url: '' // url 请求路径
}
axiosDefine(client, options);
// 使用时请在需要加密传输的接口配置headers: { isEncrypt: true },true 加密,false 不加密,不配置isEncrypt默认false
client.post('/encrypt/login', {
type: 1,
content: '配置headers'
}, {
headers: {
isEncrypt: true // isEncrypt 数据是否加密传输
}
}).then(res => {
console.log(res);
})
client.get('/userInfo', {
id: 1
}, {
headers: {
isEncrypt: true // isEncrypt 数据是否加密传输
}
}).then(res => {
console.log(res);
})
打包发布
npm install
npx microbundle
npm publish
3.7.0
2 years ago
3.6.0
2 years ago
3.5.0
2 years ago
3.4.0
2 years ago
3.3.0
2 years ago
3.2.0
2 years ago
3.1.0
2 years ago
2.9.0
2 years ago
2.8.0
2 years ago
2.7.0
2 years ago
2.6.0
2 years ago
2.5.0
2 years ago
2.4.0
2 years ago
2.3.0
2 years ago
2.2.0
2 years ago
2.1.0
2 years ago
1.9.0
2 years ago
1.8.0
2 years ago
1.7.0
2 years ago
1.6.0
2 years ago
1.5.0
2 years ago
1.4.0
2 years ago
1.3.0
2 years ago
1.2.0
2 years ago
1.1.0
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago