use of cn.taketoday.http.client.BufferingClientHttpRequestFactory in project today-infrastructure by TAKETODAY.
the class RestTemplateBuilderTests method bufferRequestBodyCanBeConfiguredOnAWrappedRequestFactory.
@Test
void bufferRequestBodyCanBeConfiguredOnAWrappedRequestFactory() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).setBufferRequestBody(false).build();
assertThat(requestFactory).hasFieldOrPropertyWithValue("bufferRequestBody", false);
this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).setBufferRequestBody(true).build();
assertThat(requestFactory).hasFieldOrPropertyWithValue("bufferRequestBody", true);
this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).build();
assertThat(requestFactory).hasFieldOrPropertyWithValue("bufferRequestBody", true);
}
use of cn.taketoday.http.client.BufferingClientHttpRequestFactory in project today-framework by TAKETODAY.
the class RestTemplateBuilderTests method connectTimeoutCanBeConfiguredOnAWrappedRequestFactory.
@Test
void connectTimeoutCanBeConfiguredOnAWrappedRequestFactory() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).setConnectTimeout(Duration.ofMillis(1234)).build();
assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234);
}
use of cn.taketoday.http.client.BufferingClientHttpRequestFactory in project today-framework by TAKETODAY.
the class RestTemplateBuilderTests method unwrappingDoesNotAffectRequestFactoryThatIsSetOnTheBuiltTemplate.
@Test
void unwrappingDoesNotAffectRequestFactoryThatIsSetOnTheBuiltTemplate() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
RestTemplate template = this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).build();
assertThat(template.getRequestFactory()).isInstanceOf(BufferingClientHttpRequestFactory.class);
}
use of cn.taketoday.http.client.BufferingClientHttpRequestFactory in project today-framework by TAKETODAY.
the class RestTemplateBuilderTests method readTimeoutCanBeConfiguredOnAWrappedRequestFactory.
@Test
void readTimeoutCanBeConfiguredOnAWrappedRequestFactory() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).setReadTimeout(Duration.ofMillis(1234)).build();
assertThat(requestFactory).hasFieldOrPropertyWithValue("readTimeout", 1234);
}
use of cn.taketoday.http.client.BufferingClientHttpRequestFactory in project today-framework by TAKETODAY.
the class RestTemplateBuilderTests method bufferRequestBodyCanBeConfiguredOnAWrappedRequestFactory.
@Test
void bufferRequestBodyCanBeConfiguredOnAWrappedRequestFactory() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).setBufferRequestBody(false).build();
assertThat(requestFactory).hasFieldOrPropertyWithValue("bufferRequestBody", false);
this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).setBufferRequestBody(true).build();
assertThat(requestFactory).hasFieldOrPropertyWithValue("bufferRequestBody", true);
this.builder.requestFactory(() -> new BufferingClientHttpRequestFactory(requestFactory)).build();
assertThat(requestFactory).hasFieldOrPropertyWithValue("bufferRequestBody", true);
}
Aggregations