0

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?

EagleBeak
  • 6,939
  • 8
  • 31
  • 47

1 Answers1

1

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();
EagleBeak
  • 6,939
  • 8
  • 31
  • 47