Commit d448c23e by liimin

1

1 parent aef25083
...@@ -28,9 +28,10 @@ function Http(options = {}) { ...@@ -28,9 +28,10 @@ function Http(options = {}) {
Http.prototype.create = function () { Http.prototype.create = function () {
this.service.interceptors.request.use( this.service.interceptors.request.use(
config => { config => {
let { data = {}, sign = true, noSignAttr = [],noNeed = false} = config let { data = {}, sign = true, noSignAttr = [], noSessionId = false } = config
if(!noNeed) if (!noSessionId) {
data.sessionId = this.customer.sessionId || data.sessionId data.sessionId = this.customer.sessionId || data.sessionId
}
if (sign) { if (sign) {
let _configSign = this.customer.sign || {} let _configSign = this.customer.sign || {}
data = util.createSign(Object.assign({}, _configSign, data), this.customer.secret, noSignAttr, this.customer.signWay) data = util.createSign(Object.assign({}, _configSign, data), this.customer.secret, noSignAttr, this.customer.signWay)
...@@ -41,7 +42,7 @@ Http.prototype.create = function () { ...@@ -41,7 +42,7 @@ Http.prototype.create = function () {
} else if (method == 'post') { } else if (method == 'post') {
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') {
config.data = data config.data = data
} else { } else {
config.data = qs.stringify(data) config.data = qs.stringify(data)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!