优化jmeter工具类
This commit is contained in:
@@ -419,15 +419,14 @@ public class JMeterUtil {
|
||||
if (responseDataList.getLength() > 0) {
|
||||
Element responseDataElement = (Element) responseDataList.item(0);
|
||||
resultMap.put("responseBody", responseDataElement.getTextContent());
|
||||
return resultMap;
|
||||
}
|
||||
// 提取子节点<responseHeader>的内容
|
||||
NodeList responseHeaderList = httpSampleElement.getElementsByTagName("responseHeader");
|
||||
if (responseHeaderList.getLength() > 0) {
|
||||
Element responseHeaderElement = (Element) responseHeaderList.item(0);
|
||||
resultMap.put("responseHeader", responseHeaderElement.getTextContent());
|
||||
return resultMap;
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -442,6 +441,9 @@ public class JMeterUtil {
|
||||
*/
|
||||
public static Map<String, String> parseHeaders(String responseHeader) {
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
if (responseHeader == null) {
|
||||
return headerMap;
|
||||
}
|
||||
// 按行拆分
|
||||
String[] lines = responseHeader.split("\n");
|
||||
// 遍历每一行
|
||||
|
||||
Reference in New Issue
Block a user