mirror of
https://github.com/YMFE/yapi.git
synced 2025-03-07 14:16:52 +08:00
fix: up interface params.path, method repeat bug
This commit is contained in:
parent
d3d93e9dbc
commit
d998549d91
@ -251,7 +251,6 @@ class interfaceController extends baseController {
|
||||
|
||||
async up(ctx) {
|
||||
let params = ctx.request.body;
|
||||
|
||||
params = yapi.commons.handleParams(params, {
|
||||
title: 'string',
|
||||
path: 'string',
|
||||
@ -279,7 +278,7 @@ class interfaceController extends baseController {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/');
|
||||
}
|
||||
|
||||
if (params.path && params.path !== interfaceData.path && params.method !== interfaceData.method) {
|
||||
if (params.path && (params.path !== interfaceData.path || params.method !== interfaceData.method) ) {
|
||||
let checkRepeat = await this.Model.checkRepeat(interfaceData.project_id, params.path, params.method);
|
||||
if (checkRepeat > 0) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 401, '已存在的接口:' + params.path + '[' + params.method + ']');
|
||||
|
@ -555,7 +555,6 @@ var interfaceController = function (_baseController) {
|
||||
case 0:
|
||||
params = ctx.request.body;
|
||||
|
||||
|
||||
params = _yapi2.default.commons.handleParams(params, {
|
||||
title: 'string',
|
||||
path: 'string',
|
||||
@ -604,7 +603,7 @@ var interfaceController = function (_baseController) {
|
||||
return _context6.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/'));
|
||||
|
||||
case 17:
|
||||
if (!(params.path && params.path !== interfaceData.path && params.method !== interfaceData.method)) {
|
||||
if (!(params.path && (params.path !== interfaceData.path || params.method !== interfaceData.method))) {
|
||||
_context6.next = 23;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user