mirror of
https://github.com/YMFE/yapi.git
synced 2025-04-06 15:00:26 +08:00
fix: 接口path中写入 ?name=xxx bug
This commit is contained in:
parent
d7d4525300
commit
7b84fac5b6
@ -1,3 +1,9 @@
|
||||
### v1.3.23
|
||||
|
||||
#### Bug Fixed
|
||||
|
||||
* 接口path中写入 ?name=xxx bug
|
||||
|
||||
### v1.3.22
|
||||
|
||||
* json schema number和integer支持枚举
|
||||
@ -5,7 +11,7 @@
|
||||
* 增加 mock 接口请求字段参数验证
|
||||
* 增加返回数据验证
|
||||
|
||||
### Bug Fixed
|
||||
#### Bug Fixed
|
||||
|
||||
* 命令行导入成员信息为 undefined
|
||||
* 修复form 参数为空时 接口无法保存的问题
|
||||
|
@ -190,13 +190,13 @@ class interfaceController extends baseController {
|
||||
});
|
||||
});
|
||||
|
||||
let checkRepeat = await this.Model.checkRepeat(params.project_id, params.path, params.method);
|
||||
let checkRepeat = await this.Model.checkRepeat(params.project_id, http_path.pathname, params.method);
|
||||
|
||||
if (checkRepeat > 0) {
|
||||
return (ctx.body = yapi.commons.resReturn(
|
||||
null,
|
||||
40022,
|
||||
'已存在的接口:' + params.path + '[' + params.method + ']'
|
||||
'已存在的接口:' + http_path.pathname + '[' + params.method + ']'
|
||||
));
|
||||
}
|
||||
|
||||
@ -556,9 +556,9 @@ class interfaceController extends baseController {
|
||||
},
|
||||
params
|
||||
);
|
||||
|
||||
let http_path;
|
||||
if (params.path) {
|
||||
let http_path = url.parse(params.path, true);
|
||||
http_path = url.parse(params.path, true);
|
||||
|
||||
if (!yapi.commons.verifyPath(http_path.pathname)) {
|
||||
return (ctx.body = yapi.commons.resReturn(
|
||||
@ -585,14 +585,14 @@ class interfaceController extends baseController {
|
||||
) {
|
||||
let checkRepeat = await this.Model.checkRepeat(
|
||||
interfaceData.project_id,
|
||||
params.path,
|
||||
http_path.pathname,
|
||||
params.method
|
||||
);
|
||||
if (checkRepeat > 0) {
|
||||
return (ctx.body = yapi.commons.resReturn(
|
||||
null,
|
||||
401,
|
||||
'已存在的接口:' + params.path + '[' + params.method + ']'
|
||||
'已存在的接口:' + http_path.pathname + '[' + params.method + ']'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ module.exports = async (ctx, next) => {
|
||||
try {
|
||||
newpath = path.substr(project.basepath.length);
|
||||
interfaceData = await interfaceInst.getByPath(project._id, newpath, ctx.method);
|
||||
|
||||
|
||||
//处理query_path情况 url 中有 ?params=xxx
|
||||
if (!interfaceData || interfaceData.length === 0) {
|
||||
interfaceData = await interfaceInst.getByQueryPath(project._id, newpath, ctx.method);
|
||||
|
@ -157,7 +157,7 @@ class interfaceModel extends baseModel {
|
||||
checkRepeat(id, path, method) {
|
||||
return this.model.count({
|
||||
project_id: id,
|
||||
path: path,
|
||||
'query_path.path': path,
|
||||
method: method
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user