Commit a70c9a7c by 张立顺

feat 修改白名单post的参数处理

1 parent 8c9464d0
...@@ -31,10 +31,10 @@ Http.prototype.create = function () { ...@@ -31,10 +31,10 @@ Http.prototype.create = function () {
async config => { async config => {
let { data = {}, sign = true, noSignAttr = [], noSessionId = false } = config let { data = {}, sign = true, noSignAttr = [], noSessionId = false } = config
// 获取白名单并检查接口 // 获取白名单并检查接口
const whiteUrl = await WhiteUrlManager.getWhiteUrls(); const whiteUrl = await WhiteUrlManager.getWhiteUrls()
if (whiteUrl.includes(data?.method)) { if (whiteUrl.includes(data?.method)) {
data.sdctag = true; data.sdctag = true
} }
if (!noSessionId) { if (!noSessionId) {
data.sessionId = this.customer.sessionId || data.sessionId data.sessionId = this.customer.sessionId || data.sessionId
...@@ -47,6 +47,11 @@ Http.prototype.create = function () { ...@@ -47,6 +47,11 @@ Http.prototype.create = function () {
if (method == 'get') { if (method == 'get') {
config.params = data config.params = data
} else if (method == 'post') { } else if (method == 'post') {
// 将 sdctag 从 data 移到 params
if (data.sdctag) {
config.params = { ...config.params, sdctag: data.sdctag }
delete data.sdctag // 从 body 中删除 sdctag
}
if (config.headers['Content-Type'] == 'multipart/form-data') { if (config.headers['Content-Type'] == 'multipart/form-data') {
config.data = util.appendFormData(data) config.data = util.appendFormData(data)
} else if (config.headers['Content-Type'] == 'application/json') { } else if (config.headers['Content-Type'] == 'application/json') {
...@@ -104,7 +109,7 @@ Http.prototype.create = function () { ...@@ -104,7 +109,7 @@ Http.prototype.create = function () {
return this.service return this.service
} }
function logout(logout_function) { function logout(logout_function) {
WhiteUrlManager.clearCache(); WhiteUrlManager.clearCache()
if (window[logout_function]) { if (window[logout_function]) {
window[logout_function](window.location.href) window[logout_function](window.location.href)
return return
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!