fix(接口测试): 修复mock匹配xml失败的缺陷
--bug=1040879 --user=王孝刚 【接口测试】Mockl-匹配规则为请求体xml,请求Mock地址时,请求体与匹配规则不匹配依然返回Mock响应 https://www.tapd.cn/55049933/s/1520575
This commit is contained in:
parent
af19dab80b
commit
8366bf33e3
|
@ -46,11 +46,12 @@ public class MockServerUtils {
|
|||
|
||||
try {
|
||||
if (request instanceof ShiroHttpServletRequest shiroHttpServletRequest) {
|
||||
List<String> contentTypeLists = List.of(MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_XML_VALUE, MediaType.TEXT_PLAIN_VALUE);
|
||||
if (StringUtils.equals(request.getContentType(), MediaType.APPLICATION_OCTET_STREAM_VALUE)) {
|
||||
InputStream inputStream = shiroHttpServletRequest.getRequest().getInputStream();
|
||||
byte[] binaryParams = inputStream.readAllBytes();
|
||||
requestParam.setBinaryParamsObj(binaryParams);
|
||||
} else if (StringUtils.equals(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) {
|
||||
} else if (contentTypeLists.contains(request.getContentType())) {
|
||||
String inputLine;
|
||||
StringBuilder receiveData = new StringBuilder();
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(
|
||||
|
|
Loading…
Reference in New Issue