Reputation: 453
I'm trying to set timeout for REST Assured request. acording the documentations the async method implement it. however, my IDE can't find this method in the source code. what i'm missing here? here is the code:
Response response=given().
body("a string").
when().
async().with().timeout(20, TimeUnit.SECONDS).post("/stringBody").
then().
body(equalTo("a string"));
REST Assured docs: https://github.com/rest-assured/rest-assured/wiki/Usage#asynchronous-requests
Upvotes: 1
Views: 4127
Reputation: 674
Try using this:
given().config(RestAssuredConfig.config() .httpClient(HttpClientConfig.httpClientConfig() .setParam("http.connection.timeout",1000)))
Upvotes: 1
Reputation: 40510
The async
method only applicable for the Spring MockMvc module. I.e. if you're specifically testing Spring applications and the using RestAssuredMockMvc API instead of the RestAssured API. The async
method is thus not available when using the standard RestAssured API.
Upvotes: 2