如何在“确保放心”的框架中中止一个请求?
例如,在“ apache”中,我们可以执行以下命令:
request.abort();
最佳答案
您可以像这样超时。还是有特定情况要中止?
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000).setConnectionRequestTimeout(5000)
.setSocketTimeout(5000).build();
HttpClientConfig httpClientFactory = HttpClientConfig.httpClientConfig()
.httpClientFactory(() -> HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build());
RestAssured.config = RestAssured.config().httpClient(httpClientFactory);