fix(接口测试): 修复TCP测试报告显示bug

This commit is contained in:
q4speed 2020-10-20 18:28:18 +08:00
parent 58a8510989
commit 2c9daecf13
1 changed files with 10 additions and 1 deletions

View File

@ -13,10 +13,13 @@ import io.metersphere.notice.service.MailService;
import io.metersphere.notice.service.NoticeService;
import io.metersphere.track.service.TestPlanTestCaseService;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.protocol.HTTP;
import org.apache.jmeter.assertions.AssertionResult;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.visualizers.backend.AbstractBackendListenerClient;
import org.apache.jmeter.visualizers.backend.BackendListenerContext;
import org.pac4j.core.context.HttpConstants;
import org.springframework.http.HttpMethod;
import java.io.Serializable;
import java.util.*;
@ -204,7 +207,13 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
return StringUtils.substringBetween(body, start, end).toUpperCase();
} else {
// Http Method
return StringUtils.substringBefore(body, " ");
String method = StringUtils.substringBefore(body, " ");
for (HttpMethod value : HttpMethod.values()) {
if (StringUtils.equals(method, value.name())) {
return method;
}
}
return "";
}
}