Skip to content

Commit a65793e

Browse files
fix 兼容iserver服务 callback 没传且 dataformat传值的情况 review by luox
1 parent 1c491ac commit a65793e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/common/iServer/CommonServiceBase.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,14 @@ export class CommonServiceBase {
125125
* @param {Object} [options.headers] - 请求头。
126126
*/
127127
request(options) {
128-
const format = options.scope.format;
128+
let format = options.scope.format;
129+
// 兼容 callback 未传,dataFormat 传入的情况
130+
if (typeof options.success === 'string') {
131+
format = options.success;
132+
options.success = null;
133+
options.failure = null;
134+
}
135+
129136
if (format && !this.supportDataFormat(format)) {
130137
throw new Error(`${this.CLASS_NAME} is not surport ${format} format!`);
131138
}

0 commit comments

Comments
 (0)