Merge pull request #1358 from kangofchen/master

当传入数据格式的 method 不规范时,容易导致获取对象为空,出现异常导致动态页面无法打开
This commit is contained in:
sean1025 2019-09-22 14:59:22 +08:00 committed by GitHub
commit c1a33a67da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -158,7 +158,7 @@ class TimeTree extends Component {
<Option title={item.title} value={item._id + ''} path={item.path} key={item._id}>
{item.title}{' '}
<Tag
style={{ color: methodColor.color, backgroundColor: methodColor.bac, border: 'unset' }}
style={{ color: methodColor ? methodColor.color : '#cfefdf', backgroundColor: methodColor ? methodColor.bac : '#00a854', border: 'unset' }}
>
{item.method}
</Tag>

View File

@ -190,6 +190,7 @@ const compareVersions = require('compare-versions');
required: param.required ? '1' : '0'
};
if (param.in) {
switch (param.in) {
case 'path':
api.req_params.push(defaultParam);
@ -208,6 +209,9 @@ const compareVersions = require('compare-versions');
api.req_headers.push(defaultParam);
break;
}
} else {
api.req_query.push(defaultParam);
}
});
}