I have a Jersey resource that returns text/csv
as ChunkedOutput
.
I'm trying to write a test with REST-assured that should verify correctness of the returned data.
Unfortunately I can't find anything about verifying chunked response data with REST assured in their docs and googling hasn't yielded anything useful.
I can verify status code, response headers, etc. like this:
given()
.spec(mySpec)
.accept("text/csv")
.when()
.post("/mycsvpath")
.then()
.statusCode(200);
I can see that the response has the Transfer-Encoding=chunked
header, but how would I verify the actual data?
OK, I figured it out. It's actually really simple:
Response r = given()
.spec(mySpec)
.accept("text/csv")
.when()
.post("/mycsvpath")
String data = r.asString();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.