标签:void 响应 lock div plain 5.0 tty nal public
报错信息:
java.lang.IllegalStateException: Expected response body to be verified as JSON, HTML or XML but content-type ‘text/plain‘ is not supported out of the box.
Try registering a custom parser using:
RestAssured.registerParser("text/plain", <parser type>);
解决方案:
1.使用预定义解析器:RestAssured.registerParser("text/plain", Parser.JSON);
public static void registerParser(String contentType, Parser parser)
get(“/ x”)。then()。assertThat()。body(“document.child”,equalsTo(“something”))..由于默认情况下,由于应用程序/自定义未被注册为由XML解析器处理,因此您需要在发出请求之前明确地告诉REST Assured使用此解析器:
RestAssured.registerParser(“application / custom,Parser.XML”);
contentType
- 要注册的内容类型parser
- 验证响应时使用的解析器。rest-Assured-解析json错误-需使用预定义的解析器解析
标签:void 响应 lock div plain 5.0 tty nal public
原文地址:http://www.cnblogs.com/lin-123/p/7110282.html