Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Rest Assured to Wait until complete response data is returned

Would you please advise how to configure RestAssured to wait until complete response data is returned.

I am trying to validate a data feed using http get as shown below.

given()
        .relaxedHTTPSValidation()
        .header("Content-Type", "application/json")
.when()

        .get("/API/data/")

.then()

        .statusCode(200)
        .log().all();

In this context, Rest Assured logging only few lines of data, does not seem to wait until complete response data is returned . This works ok when data response is small.

In this case, it seems to log only data that's available when http status code is returned.

Consequently I am seeing the following error message: Premature end of Content-Length delimited message body (expected: 1486; received: 1088)

Thx

like image 781
brzspirit Avatar asked Dec 28 '25 18:12

brzspirit


1 Answers

If you want to check the status code you should use the expect().statusCode(x).

Anyway the tool waits until the whole response is returned from the server and only logs it out after that. So it shouldn't be a problem with big JSON/XML responses either.

like image 118
Gergely A. Avatar answered Dec 30 '25 06:12

Gergely A.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!