feat(接口测试): swagger的url导入支持自定义token
--bug=1046842 --user=宋天阳 【接口测试】导入接口-swagger导入带token-导入解析失败 https://www.tapd.cn/55049933/s/1582539
This commit is contained in:
parent
95209738b0
commit
03bbba5ede
|
@ -121,12 +121,18 @@ public class Swagger3ParserApiDefinition extends HttpApiDefinitionImportAbstract
|
|||
|
||||
// 设置 headers
|
||||
if (StringUtils.isNotBlank(request.getSwaggerToken())) {
|
||||
String[] tokenRows = StringUtils.split(request.getSwaggerToken(), StringUtils.LF);
|
||||
for (String row : tokenRows) {
|
||||
String[] tokenArr = StringUtils.split(row, ":");
|
||||
if (tokenArr.length == 2) {
|
||||
AuthorizationValue authorizationValue = new AuthorizationValue();
|
||||
authorizationValue.setType(HEADER);
|
||||
authorizationValue.setKeyName("token");
|
||||
authorizationValue.setValue(request.getSwaggerToken());
|
||||
authorizationValue.setKeyName(tokenArr[0]);
|
||||
authorizationValue.setValue(tokenArr[1]);
|
||||
auths.add(authorizationValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CollectionUtils.size(auths) == 0 ? null : auths;
|
||||
}
|
||||
|
|
|
@ -158,7 +158,12 @@
|
|||
></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item field="token" label="token" asterisk-position="end">
|
||||
<a-input v-model:model-value="importForm.swaggerToken" class="w-[700px]" allow-clear></a-input>
|
||||
<a-textarea
|
||||
v-model:model-value="importForm.swaggerToken"
|
||||
:auto-size="{ minRows: 1 }"
|
||||
class="w-[700px]"
|
||||
allow-clear
|
||||
/>
|
||||
</a-form-item>
|
||||
<div class="mb-[16px] flex items-center gap-[8px]">
|
||||
<a-switch v-model:model-value="importForm.authSwitch" type="line" size="small"></a-switch>
|
||||
|
@ -228,7 +233,12 @@
|
|||
></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item field="token" label="token" asterisk-position="end">
|
||||
<a-input v-model:model-value="importForm.swaggerToken" class="w-[700px]" allow-clear></a-input>
|
||||
<a-textarea
|
||||
v-model:model-value="importForm.swaggerToken"
|
||||
:auto-size="{ minRows: 1 }"
|
||||
class="w-[700px]"
|
||||
allow-clear
|
||||
/>
|
||||
</a-form-item>
|
||||
<div class="mb-[16px] flex items-center gap-[8px]">
|
||||
<a-switch v-model:model-value="importForm.authSwitch" type="line" size="small"></a-switch>
|
||||
|
|
Loading…
Reference in New Issue