我正在尝试RestAssured并撰写以下声明 -
String URL = "http://XXXXXXXX";
Response result = given().
header("Authorization","Basic xxxx").
contentType("application/json").
when().
get(url);
JsonPath jp = new JsonPath(result.asString());
在最后一个声明中,我收到以下异常:
org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected
我的回复中返回的标头是:
Content-Type → application/json; qs=1
Date → Tue, 10 Nov 2015 02:58:47 GMT
Transfer-Encoding → chunked
任何人都可以指导我解决这个异常并指出我是否遗漏了任何内容或任何不正确的实现。
也许你可以尝试摆弄connection config?例如:
given().config(RestAssured.config().connectionConfig(connectionConfig().closeIdleConnectionsAfterEachResponse())). ..