Commit aef25083 by 杨明

更改post请求格式

1 parent 46500def
{ {
"name": "glsx-common", "name": "glsx-common",
"version": "1.3.2", "version": "2.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
......
...@@ -28,7 +28,8 @@ function Http(options = {}) { ...@@ -28,7 +28,8 @@ 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 = [] } = config let { data = {}, sign = true, noSignAttr = [],noNeed = false} = config
if(!noNeed)
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 || {}
...@@ -40,6 +41,8 @@ Http.prototype.create = function () { ...@@ -40,6 +41,8 @@ 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') {
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!