fix(接口测试): 修复jmeter导入时针对header处理的相关方法

This commit is contained in:
Jianguo-Genius 2024-12-05 19:03:16 +08:00 committed by Craftsman
parent 0608840cb0
commit 9e06b36f6f
1 changed files with 4 additions and 7 deletions

View File

@ -4,7 +4,6 @@ import io.metersphere.api.dto.request.http.MsHTTPElement;
import io.metersphere.api.dto.request.http.MsHeader;
import io.metersphere.plugin.api.spi.AbstractMsElementConverter;
import io.metersphere.plugin.api.spi.AbstractMsTestElement;
import jodd.util.StringUtil;
import org.apache.jmeter.protocol.http.control.HeaderManager;
import org.apache.jmeter.testelement.property.CollectionProperty;
import org.apache.jmeter.testelement.property.JMeterProperty;
@ -23,13 +22,11 @@ public class HeaderManagerConverter extends AbstractMsElementConverter<HeaderMan
List<String> extendsHeaderKey = headerKvList.stream().map(MsHeader::getKey).toList();
for (int i = 0; i < collectionProperty.size(); i++) {
JMeterProperty jMeterProperty = collectionProperty.get(i);
String key = jMeterProperty.getName();
String value = jMeterProperty.getStringValue();
if (StringUtil.isEmpty(key)) {
String[] valueArr = value.split("\t");
key = valueArr[0];
value = valueArr[1];
}
String[] valueArr = value.split("\t");
String key = valueArr[0];
value = valueArr[1];
if (!extendsHeaderKey.contains(key)) {
String finalKey = key;
String finalValue = value;