I need to verify a text/event-stream response for its content up to a certain point in time after the request was sent. The response stream is kept alive indefinitely for new events.
The following code does not work:
given()
.contentType(JSON)
.when()
.get("/mypath/") // This method blocks indefinitely, never reaching the "then" block
.then()
.response()
.extract()
.asString()
How can we close the response stream at a certain point to access what it has so far? Or perhaps intercept the underlying InputStream of the response asynchronously somehow?