完善sdk-nodejs-axios分支

pull/12/head
Changeden 4 years ago
parent ccca3c26ee
commit f09e00ddd7
  1. 19
      sop-sdk/sdk-nodejs-axios/common/BaseRequest.js

@ -2,7 +2,7 @@ const isArray = require('isarray');
/** /**
* 请求类父类 * 请求类父类
*/ */
exports.BaseRequest = class BaseRequest { module.exports = class BaseRequest {
constructor() { constructor() {
this.bizModel = {}; this.bizModel = {};
@ -10,6 +10,21 @@ exports.BaseRequest = class BaseRequest {
// 用于文件上传时强制转换成POST_FILE请求 // 用于文件上传时强制转换成POST_FILE请求
this.__forceRequestType__ = undefined; this.__forceRequestType__ = undefined;
this.checkOverride();
}
/**
* 校验子类是否已重写相关方法
* */
checkOverride() {
try {
this.getMethod();
this.getVersion();
this.getRequestType();
} catch (error) {
throw error;
}
} }
setBizModel(biz = {}) { setBizModel(biz = {}) {
@ -22,7 +37,7 @@ exports.BaseRequest = class BaseRequest {
return this; return this;
} }
addFile({name, path}) { addFile(name, path) {
if (name && path) { if (name && path) {
if (!isArray(this.files)) { if (!isArray(this.files)) {
this.files = []; this.files = [];
Loading…
Cancel
Save