fix: basepath is empty bug and add http_request_header key

This commit is contained in:
sean 2017-08-30 11:14:15 +08:00
parent 1513891eec
commit 220ee5eec1
5 changed files with 40 additions and 43 deletions

View File

@ -76,5 +76,6 @@ export default {
'fork',
'android-o',
'apple-o'
]
],
HTTP_REQUEST_HEADER: ["Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language", "Accept-Datetime", "Authorization", "Cache-Control", "Connection", "Cookie", "Content-Disposition", "Content-Length", "Content-MD5", "Content-Type", "Date", "Expect", "From", "Host", "If-Match", "If-Modified-Since", "If-None-Match", "If-Range", "If-Unmodified-Since", "Max-Forwards", "Origin", "Pragma", "Proxy-Authorization", "Range", "Referer", "TE", "User-Agent", "Upgrade", "Via", "Warning", "X-Requested-With", "DNT", "X-Forwarded-For", "X-Forwarded-Host", "X-Forwarded-Proto", "Front-End-Https", "X-Http-Method-Override", "X-ATT-DeviceId", "X-Wap-Profile", "Proxy-Connection", "X-UIDH", "X-Csrf-Token"]
}

View File

@ -307,28 +307,28 @@ class interfaceController extends baseController {
up_time: yapi.commons.time()
};
if (params.path) {
if (!_.isUndefined(params.path)) {
data.path = params.path;
}
if (params.title) {
if (!_.isUndefined(params.title)) {
data.title = params.title;
}
if (params.desc) {
if (!_.isUndefined(params.desc)) {
data.desc = params.desc;
}
if (params.method) {
if (!_.isUndefined(params.method)) {
data.method = params.method;
}
if (params.catid) {
if (!_.isUndefined(params.catid)) {
data.catid = params.catid;
}
if (params.req_headers) {
if (!_.isUndefined(params.req_headers)) {
data.req_headers = params.req_headers;
}
if (params.req_body_form) {
if (!_.isUndefined(params.req_body_form)) {
data.req_body_form = params.req_body_form;
}
if (params.req_params && Array.isArray(params.req_params) && params.req_params.length > 0) {
@ -338,25 +338,25 @@ class interfaceController extends baseController {
data.type = 'static'
}
if (params.req_query) {
if (!_.isUndefined(params.req_query)) {
data.req_query = params.req_query;
}
if (params.req_body_other) {
if (!_.isUndefined(params.req_body_other)) {
data.req_body_other = params.req_body_other;
}
if (params.req_body_type) {
if (!_.isUndefined(params.req_body_type)) {
data.req_body_type = params.req_body_type;
}
if (params.res_body_type) {
if (!_.isUndefined(params.res_body_type)) {
data.res_body_type = params.res_body_type;
}
if (params.res_body) {
if (!_.isUndefined(params.res_body)) {
data.res_body = params.res_body;
}
if (params.status) {
if (!_.isUndefined(params.status)) {
data.status = params.status;
}

View File

@ -560,14 +560,12 @@ class projectController extends baseController {
data.project_type = params.project_type
}
if (params.name) data.name = params.name;
if (params.desc) data.desc = params.desc;
if (params.basepath) {
data.basepath = params.basepath;
}
if (params.env) data.env = params.env;
if (params.color) data.color = params.color;
if (params.icon) data.icon = params.icon;
if (!_.isUndefined(params.name)) data.name = params.name;
if (!_.isUndefined(params.desc)) data.desc = params.desc;
data.basepath = params.basepath;
if (!_.isUndefined(params.env)) data.env = params.env;
if (!_.isUndefined(params.color)) data.color = params.color;
if (!_.isUndefined(params.icon)) data.icon = params.icon;
let result = await this.Model.up(id, data);
let username = this.getUsername();
yapi.commons.saveLog({

View File

@ -649,28 +649,28 @@ var interfaceController = function (_baseController) {
};
if (params.path) {
if (!_underscore2.default.isUndefined(params.path)) {
data.path = params.path;
}
if (params.title) {
if (!_underscore2.default.isUndefined(params.title)) {
data.title = params.title;
}
if (params.desc) {
if (!_underscore2.default.isUndefined(params.desc)) {
data.desc = params.desc;
}
if (params.method) {
if (!_underscore2.default.isUndefined(params.method)) {
data.method = params.method;
}
if (params.catid) {
if (!_underscore2.default.isUndefined(params.catid)) {
data.catid = params.catid;
}
if (params.req_headers) {
if (!_underscore2.default.isUndefined(params.req_headers)) {
data.req_headers = params.req_headers;
}
if (params.req_body_form) {
if (!_underscore2.default.isUndefined(params.req_body_form)) {
data.req_body_form = params.req_body_form;
}
if (params.req_params && Array.isArray(params.req_params) && params.req_params.length > 0) {
@ -680,25 +680,25 @@ var interfaceController = function (_baseController) {
data.type = 'static';
}
if (params.req_query) {
if (!_underscore2.default.isUndefined(params.req_query)) {
data.req_query = params.req_query;
}
if (params.req_body_other) {
if (!_underscore2.default.isUndefined(params.req_body_other)) {
data.req_body_other = params.req_body_other;
}
if (params.req_body_type) {
if (!_underscore2.default.isUndefined(params.req_body_type)) {
data.req_body_type = params.req_body_type;
}
if (params.res_body_type) {
if (!_underscore2.default.isUndefined(params.res_body_type)) {
data.res_body_type = params.res_body_type;
}
if (params.res_body) {
if (!_underscore2.default.isUndefined(params.res_body)) {
data.res_body = params.res_body;
}
if (params.status) {
if (!_underscore2.default.isUndefined(params.status)) {
data.status = params.status;
}

View File

@ -1285,14 +1285,12 @@ var projectController = function (_baseController) {
data.project_type = params.project_type;
}
if (params.name) data.name = params.name;
if (params.desc) data.desc = params.desc;
if (params.basepath) {
data.basepath = params.basepath;
}
if (params.env) data.env = params.env;
if (params.color) data.color = params.color;
if (params.icon) data.icon = params.icon;
if (!_underscore2.default.isUndefined(params.name)) data.name = params.name;
if (!_underscore2.default.isUndefined(params.desc)) data.desc = params.desc;
data.basepath = params.basepath;
if (!_underscore2.default.isUndefined(params.env)) data.env = params.env;
if (!_underscore2.default.isUndefined(params.color)) data.color = params.color;
if (!_underscore2.default.isUndefined(params.icon)) data.icon = params.icon;
_context12.next = 34;
return this.Model.up(id, data);